-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.5] class_uses_recursive() return parent class's trait first #22536
Conversation
tests/Support/SupportHelpersTest.php
Outdated
@@ -699,20 +699,27 @@ public function testLast() | |||
|
|||
public function testClassUsesRecursiveShouldReturnTraitsOnParentClasses() | |||
{ | |||
$this->assertEquals([ | |||
'Illuminate\Tests\Support\SupportTestTraitOne' => 'Illuminate\Tests\Support\SupportTestTraitOne', | |||
$this->assertTrue([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use assertSame
instead. It checks strict
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! 👍
This sounds like a breaking change and something that should target the 5.6 release (the master branch). |
I think this should be a Bug, In my case, subclass boot depend on the data generated by parent class's boot. On the contrary, parent class's boot certainly not depend on subclass's boot. |
You're not changing just how model traits are initiated, you are changing how the global helper class_uses_recursive works. This could affect a lot more things that just your specific scenario. Thus I argue that it should target the 5.6 release and be documented as a change in the upgrade guide. |
ok |
new PR is #22537 |
Reason
when Model booting traits, subclass's trait will boot before parent's trait, It is quite different from dev's expectation.
Changed
class_uses_recursive()
return traits order byuse
order.assertEquals
does not validate the order of array elements , so i change toassertSame