Created
May 12, 2016 05:30
-
-
Save alcaeus/16d869adf686032b2b5f85719e6c50d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
class Foo | |
{ | |
/** | |
* @return self | |
*/ | |
public function foo() | |
{ | |
return $this; | |
} | |
/** | |
* @return $this | |
*/ | |
public function fooThis() | |
{ | |
return $this; | |
} | |
} | |
class Bar extends Foo | |
{ | |
public function bar() | |
{ | |
echo "Yes!"; | |
} | |
} | |
// PhpStorm does not offer bar() as method here due to @return self | |
(new Bar())->foo()->bar(); | |
// PhpStorm correctly handles code completion | |
(new Bar())->fooThis()->bar(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment