Created
November 5, 2025 01:55
-
-
Save rlerdorf/fa324b0b4bb6d499f1d69994b037e678 to your computer and use it in GitHub Desktop.
Phan Demo - PHP 84, Phan v6-dev
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 | |
| interface Interface2 { | |
| } | |
| interface Interface1 extends Interface2 { | |
| public function someMethod1(); | |
| } | |
| class Class1 implements Interface1{ | |
| public function someMethod1() { | |
| echo "Hello there"; | |
| } | |
| } | |
| class Class2 { | |
| protected Interface2 $my_internal_instance; | |
| public function __construct() { | |
| $this->my_internal_instance = new Class1(); | |
| } | |
| public function someMethod1() { | |
| return $this->my_internal_instance->someMethod1(); | |
| } | |
| } | |
| class Class4 implements Interface2{ | |
| } | |
| class Class3 extends Class2 { | |
| public function setWrong() { | |
| $this->my_internal_instance = new Class4(); | |
| } | |
| } | |
| $instance = new Class3(); | |
| $instance->setWrong(); | |
| $instance->someMethod1(); |
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
| { | |
| "phpVersion": "84", | |
| "phanVersion": "v6-dev", | |
| "astVersion": "1.1.3", | |
| "plugins": "310592423266", | |
| "fileOrder": [ | |
| "Interface-test.php" | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment