-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Namespace move BC compatibility layer #71
Namespace move BC compatibility layer #71
Conversation
.' Use \Doctrine\Persistence\NotifyPropertyChanged instead.', | ||
E_USER_DEPRECATED | ||
); | ||
} |
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.
Are you ok with this or do you think line 20 should be enough?
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.
If the DebugClassLoader already triggers a deprecation based on the @deprecated
annotation we should skip this to avoid duplicate deprecation messages. Otherwise, I definitely want to keep these in.
// cc @nicolas-grekas
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.
That practice on Symfony is to still add all possible runtime deprecations, because using the DebugClassLoader is optional, especially when using packages standalone.
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.
That clears it up. Thanks Nicolas!
@greg0ire I would suggest we add this deprecation message to all deprecated classes/interfaces.
Heads up, I’ll push a 1.3.x branch for this to target. We’ll add more compatibility layers in there for the BC breaks in 2.0. |
.' Use \Doctrine\Persistence\NotifyPropertyChanged instead.', | ||
E_USER_DEPRECATED | ||
); | ||
} |
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.
If the DebugClassLoader already triggers a deprecation based on the @deprecated
annotation we should skip this to avoid duplicate deprecation messages. Otherwise, I definitely want to keep these in.
// cc @nicolas-grekas
9a2f323
to
a40e414
Compare
Travis fails because of |
I checked that tests that used all class names still work, you can do too by checkout out this PR, then running |
a38e3df
to
c494e68
Compare
I fixed conflicts and reverted the move of |
10a6d1f
to
425d6c0
Compare
This has already been done on master, let us do it again, but with a BC layer.
425d6c0
to
548f75f
Compare
@greg0ire feel free to add exceptions to phpcs.xml for the current naming errors. These should be taken care of separately - I don't feel comfortable shoving that into 2.0 at this point. |
We are not sure yet how this classes will be dealt with.
Oh right, I assumed the phpcs was enabled on touched/new files only somehow. I pushed a separate commit. Tell me if you meant to have a separate PR |
Thanks @greg0ire! |
Tests on Symfony fail with deprecations after this change so I'm on a PR to fix them. The issue is that class_alias doesn't work, because if a type hint uses the legacy one, no deprecation will be triggered - and the alias won't ever be loaded - but PHP will fail with a fatal error saying "incompatible type hint". Fixing this would require loading the alias all the time (and thus removing the deprecation, which is fine if there is no better way...) |
Thanks for the feedback! I’ll try to work on this today. |
…ersistence (nicolas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [DoctrineBridge] try to fix deprecations from doctrine/persistence | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follows doctrine/persistence#71 But the BC layer is not working yet, as highlighted by the `XXX` in the attached patch. At least for the corresponding interfaces, doctrine/persistence should always alias the legacy name to the new one. /cc @greg0ire @alcaeus FYI Commits ------- 53a4711 [DoctrineBridge] try to fix deprecations from doctrine/persistence
Actually the aliases are always loaded, my bad. I made 3.4 green. Let's try with upper branches. |
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
Honestly this approach is disgusting as it totally breaks preloading. |
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71
This is perfectly fine if our aim is to not break the entire ecosystem. If preloading breaks, you’re welcome to create a PR to fix it without removing the deprecation layer. Thanks. |
This is just a draft, tell me what you think about the example, and I will squash my commits and apply it to all other classes.
Please tell me what should be done about the tests. I assumed they should use the new names, but tell me if you think previous tests with the old names should be kept in a
Legacy
subdirectory.The corresponding commit on master is fed87eb