Skip to content

Add attribute support, remove deprecations, unify JMSParser #51

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

Merged
merged 5 commits into from
Jun 21, 2025

Conversation

Spea
Copy link
Contributor

@Spea Spea commented Jun 20, 2025

  • Add attribute support for the Preferred annotation
  • Remove deprecation
  • Drop support for doctrine/annotations 1.x
  • Unify the JMSParser(Test)
    When readonly became a reserved word in PHP 8.1, it was required to have two implementations of the JMSParser. One for versions below PHP 8.0, and one for PHP 8.1 and higher.
    However, the jms serializer library itself renamed the offending class to DeprecatedReadOnly (with an alias to the old class name) and it also extends the ReadOnlyProperty attribute, so having a separate class for it in here is no longer necessary.

Fixes #46 and #48

@dbu While this would theoretically be everything required for a 2.0 release, I just wanted to mention that I'm also working on adding support for discriminators, though this could also be added with 2.1.

@@ -13,6 +13,7 @@
* @Annotation
* @Target({"METHOD", "PROPERTY"})
*/
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the whole project still supports annotations. Given that the library itself only supports PHP > 8.0 and attributes are out for over 3 years already, should we drop annotation support, or just keep it, as it does not really hurt?

Spea added 5 commits June 20, 2025 15:06
When `readonly` became a reserved word in PHP 8.1, it was required to have two implementations of the `JMSParser`. One for versions below PHP 8.0, and one for PHP 8.1 and higher.
However, the jms serializer library itself now renamed the offending class to `DeprecatedReadOnly`  (with an alias to the old clas name) and it also extends the `ReadOnlyProperty` attribute, so having a separate class for it in here is no longer necessary.
@Spea Spea force-pushed the attribute-support branch from 3b88ace to 9c1ea16 Compare June 20, 2025 13:08
Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot!

as we plan a new major version, i think its a good moment to drop annotations support, before we have to worry about BC. people stuck on annotations can continue to use the 1.x version.

@dbu dbu merged commit 1267d98 into liip:2.x Jun 21, 2025
7 checks passed
@dbu
Copy link
Member

dbu commented Jun 21, 2025

i merged this. glad if you want to remove annotation support and if you do a separate pull request to support discriminators (attribute only)

@dbu dbu mentioned this pull request Jun 25, 2025
@Spea Spea deleted the attribute-support branch June 26, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants