Created
March 2, 2018 14:46
-
-
Save hnw/141c1af2f0641b3696c474ad0dae8056 to your computer and use it in GitHub Desktop.
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 | |
abstract class Foo { | |
abstract public function func(int $y); | |
} | |
class Bar extends Foo { | |
public function func(int $y) { | |
return 1; | |
} | |
} | |
class Baz extends Bar { | |
public function func(int $y) { | |
} | |
} | |
$cl = new ReflectionClass(new Baz()); | |
$methods = $cl->getMethods(); | |
foreach ($methods as $mt) { | |
printf("method: class=%s, name=%s\n", $mt->getDeclaringClass()->getName(), $mt->getName()); | |
$proto = $mt->getPrototype(); | |
printf("prototype: class=%s name=%s\n", $proto->getDeclaringClass()->getName(), $proto->getName()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment