Closed josemmo closed 3 years ago
Thanks for reporting this regression. I was looking into this topic some more. And I think we should revisit the way this library handles traits. version 4 had some limitations regarding the usage of traits. Since trait use is way more complex than this lib originally did. And I would like to introduce it full featured. Because we would need it for phpDocumentor itself.
The easiest syntax of traits is this:
class MyClass {
use MyTrait;
}
But a full blown setup would be something like:
https://www.php.net/manual/en/language.oop5.traits.php#123648
class MyClass {
use A, B, C {
//visibility for methods that will be involved in conflict resolution
B::smallTalk as public;
A::bigTalk as public;
//conflict resolution
B::smallTalk insteadof A, C;
A::bigTalk insteadof B, C;
//aliases with visibility change
B::bigTalk as public Btalk;
A::smallTalk as public asmalltalk;
//aliases only, methods already defined as public
C::bigTalk as Ctalk;
C::smallTalk as cmallstalk;
}
}
This would require a more complex model for used traits. Which we should introduce.
I reintroduced the original behavior. I will start working on the more complex implementation soon. This will be a different method.
In version 5.0.0, in contrast with 4.0.1,
Class_::$usedTraits
is never initialized when usingProjectFactory
.How to reproduce
index.php
TestClass.php
TestTrait.php
Output
When using v4.0.1:
When using v5.0.0: