Last active
July 24, 2019 07:19
-
-
Save jbdelhommeau/4ec6488f2be28131b58d86c2241b3b06 to your computer and use it in GitHub Desktop.
Phptorm mistake with __invoke function autocomplete and click to go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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