Created
April 3, 2014 09:06
-
-
Save carlescliment/9951042 to your computer and use it in GitHub Desktop.
class_uses does not work on subclasses
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
Trait SomeTrait | |
{ | |
} | |
class A | |
{ | |
use SomeTrait; | |
} | |
class B extends A | |
{ | |
} | |
var_dump(class_uses(new A)); | |
var_dump(class_uses(new B)); | |
// The output is: | |
array(1) { | |
["SomeTrait"]=> | |
string(9) "SomeTrait" | |
} | |
array(0) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DIrectly from the php documentation: