Skip to content

Instantly share code, notes, and snippets.

@jbdelhommeau
Last active July 24, 2019 07:19
Show Gist options
  • Save jbdelhommeau/4ec6488f2be28131b58d86c2241b3b06 to your computer and use it in GitHub Desktop.
Save jbdelhommeau/4ec6488f2be28131b58d86c2241b3b06 to your computer and use it in GitHub Desktop.
Phptorm mistake with __invoke function autocomplete and click to go
<?php
namespace App;
use App\InvokeMe;
use App\Dependency2;
class CallMeBaby
{
private $dep2;
private $invokeMe;
public function __construct(
Dependency2 $dep2,
InvokeMe $invokeMe
) {
$this->dep2 = $dep2;
$this->invokeMe = $invokeMe;
}
public function otherAction(): void
{
($this->invokeMe)('I <3 PhpStorm');
$this->dep2->save();
}
}
<?php
namespace App;
use App\Dependency;
class InvokeMe
{
private $dep;
public function __construct(Dependency $dep)
{
$this->dep = $dep;
}
public function __invoke(string $paramerter): void
{
$dep->action();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment