Created
May 25, 2014 10:45
-
-
Save MartyIX/a9dfe8bcccdef58da746 to your computer and use it in GitHub Desktop.
return type hint
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 | |
class A { | |
/** | |
* @return self | |
*/ | |
public function someMethod() { | |
return $this; | |
} | |
} | |
class B extends A { | |
public function onlyInB() { | |
} | |
} | |
$b = new B(); | |
$b->someMethod()->onlyInB(); // PhpStorm IDE does not know 'onlyInB' method. If I change "self" to "static" / "$this" it works just fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment