Skip to content

Instantly share code, notes, and snippets.

@rlerdorf
Created November 5, 2025 01:55
Show Gist options
  • Select an option

  • Save rlerdorf/fa324b0b4bb6d499f1d69994b037e678 to your computer and use it in GitHub Desktop.

Select an option

Save rlerdorf/fa324b0b4bb6d499f1d69994b037e678 to your computer and use it in GitHub Desktop.
Phan Demo - PHP 84, Phan v6-dev
<?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();
{
"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