-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Serialization versioning #31033
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
[Serializer] Serialization versioning #31033
Conversation
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.
I am not sure, but did you added tests where >= ?
* @param AttributeMetadataInterface $attributeMetadata | ||
* | ||
* @return bool | ||
*/ |
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.
The whole doc block can be removed, as it doesn’t add any value. Or add some description and only remove return phpdoc
return true; | ||
} | ||
|
||
if (null !== $sinceVersion && version_compare($sinceVersion, $context['version'], '>')) { |
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.
I guess it should be '>=' here such as the first example here: https://www.php.net/manual/en/function.version-compare.php
I would like to use Since like this: @Since("2.0")
to say 2.0 included.
I would like to use Until like this @Until("2.0")
to say 2.0 excluded.
Thanks a lot.
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.
Shouldn't we use a semver-compliant comparator instead of version_compare
? Semver is the de-facto standard for API versioning (among other things).
For instance, we could use https://github.com/composer/semver.
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.
Except the BC Break, looks great. :}
/** | ||
* Gets the version number after which the attribute must not be serialized. | ||
*/ | ||
public function getUntil(): ?string; |
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.
theses changes are a bc break (you can't modify and add / remove methods / constants on an interface).
This should be documented in the upgrade file, and on 5.0 these methods should be added on the interface.
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.
This interface is internal, so it's allowed.
…is type of parameter type (pfazzi) This PR was merged into the 4.4 branch. Discussion ---------- [DI] CheckTypeDeclarationsPass now checks if value is type of parameter type | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | symfony#35420 | License | MIT Commits ------- 0d4c0a6 [DI] CheckTypeDeclarationsPass now checks if value is type of parameter type
…oni14) This PR was merged into the 4.4 branch. Discussion ---------- [SecurityBundle] fix ldap_bind service arguments | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT The 6th argument of `LdapBindAuthenticationProvider` was not correctly set in the service declaration `security_listeners.xml`. Thus, instead `'Invalid credentials.'` we had `'User "foo" not found.'`. Commits ------- 7ec6a09 [SecurityBundle] fix security.authentication.provider.ldap_bind arguments
…ding default param in SF 6.0 (lyrixx) This PR was merged into the 5.1-dev branch. Discussion ---------- [Console] Set Command::setHidden() final for adding default param in SF 6.0 | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- e2ede07 [Console] Add default parameter (true) for Command::setHidden()
…t work (duncan3dc) This PR was merged into the 4.3 branch. Discussion ---------- [Lock] Don't allow mysqli to be used as it doesn't work | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Mysqli doesn't support named parameters, so if you pass a doctrine connection using `mysqli` then you get the following error: `You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':id, :token, UNIX_TIMESTAMP() + 300)'` This PR ensures a clear error is provided and suggests to use `pdo_mysql` instead Commits ------- ef3bcda Mysqli doesn't support the named parameters used by PdoStore
…ArrayCache (nicolas-grekas) This PR was merged into the 5.1-dev branch. Discussion ---------- [Cache] Add LRU + max-lifetime capabilities to ArrayCache | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix https://github.com/orgs/symfony/projects/1#card-30686676 | License | MIT | Doc PR | - In symfony#32294 (comment), @andrerom writes: > if you plan to expose use of ArrayAdapter to a wider audience you should probably also add the following features to it: > - max item limit to avoid reaching memory limits > - own (very low, like default 100-500ms) TTL for in-memory caching, as it's in practice stale data when used in concurrent scenarios > > If you want to be advance you can also: > > - keep track of use, and evict cache items based on that using LFU when reaching limit > - in-memory cache is domain & project specific in terms of how long it's somewhat "safe" to keep items in memory, so either describe when to use and not use on a per pool term, or allow use of pool to pass in flags to opt out of in-memory cache for cases developer knows it should be ignored This PR implements these suggestions, via two new constructor arguments: `$maxLifetime` and `$maxItems`. In Yaml: ```yaml services: app.lru150_cache: parent: cache.adapter.array arguments: $maxItems: 150 $maxLifetime: 0.150 framework: cache: pools: my_chained_pool: adapters: - app.lru150_cache - cache.adapter.filesystem ``` This configuration adds a local memory cache that keeps max 150 elements for 150ms on top of a filesystem cache. /cc @lyrixx since you were also interested in it. Commits ------- 48a5d5e [Cache] Add LRU + max-lifetime capabilities to ArrayCache
…Converter (lyrixx) This PR was merged into the 5.1-dev branch. Discussion ---------- [CssSelector] Added cache on top of CssSelectorConverter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- ed11d52 [CssSelector] Added cache on top of CssSelectorConverter
This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] Fix messenger argument | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - `Connection::DEFAULT_OPTIONS` is an key/value array. The exception `Unknown option found : [%s]. Allowed options are [%s]` should use allowed option's key instead of the value. Commits ------- ae0c634 Fix exception message in Doctrine Messenger
…s (Nyholm) This PR was squashed before being merged into the 5.1-dev branch (closes symfony#35422). Discussion ---------- [Messenger] Move Transports to separate packages | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | coming I think it is a good idea to have the transports in a separate package. The benefits a many: - It allows us to have usage statistics - The core messenger package is smaller - Transports can have dependencies specified in composer.json instead of just suggests This PR will not break BC but it requires to configure subtree split. Commits ------- 2990c8f [Messenger] Move Transports to separate packages
…ling Dotenv::loadEnv()
…ations (azjezz) This PR was merged into the 5.1-dev branch. Discussion ---------- [Mailer] read default timeout from ini configurations | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | symfony#35138 | License | MIT | Doc PR | n/a ```env MAILER_DSN=mandrill+https://foo@default?timeout=30 ``` Commits ------- dafb057 [Mailer] read default timeout from ini configurations
…rification via DSN (Aurélien Fontaine) This PR was squashed before being merged into the 5.1-dev branch (closes symfony#35262). Discussion ---------- [Mailer] add ability to disable the TLS peer verification via DSN | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix | License | MIT | Doc PR | symfony/symfony-docs/pull/12997 Add the ability to disable the peer TLS verification with the DNS when using `EsmtpTransport` like this : ``` MAILER_DSN=smtp://foo@default?verify_peer=false ``` By default the verification is enabled Commits ------- 4b854da [Mailer] add ability to disable the TLS peer verification via DSN
Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.
… (X-Coder264) This PR was merged into the 5.1-dev branch. Discussion ---------- [DI] Enable auto alias compiler pass by default | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | | Deprecations? | no | Tickets | Fix symfony#34194 | License | MIT | Doc PR | I'm sending this PR to trigger a discussion as @nicolas-grekas suggested in symfony#34194 I'm using this quite a lot in one of my applications and I don't see any reasons why it shouldn't be enabled by default. Commits ------- 4fde517 Enable auto alias compiler pass by default
…fancyweb) This PR was merged into the 5.1-dev branch. Discussion ---------- [Form] Add "is empty callback" to form config | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#31572 for 4.4+ | License | MIT | Doc PR | - This PR introduces a new feature that allow to resolve a bug. Currently, the `isEmpty()` behavior of the `Form` class is the same whatever its configuration. That prevents us to specify a different behavior by form type. But I think that some form types should have dedicated empty values. For example, the `CheckboxType` model data either resolves to `true` (checked) or `false` (unchecked). But `false` is not an empty value in the `Form::isEmpty()` method, so a `CheckboxType` form can never be empty. `false` should not be in that list because for other form types, it's perfectly fine that it's not considered as an empty value. The problem is better seen in symfony#31572 with a `ChoiceType` that is never considered as empty (when no radio button is checked). Being able to specify the "is empty" behavior by form type would also allow users to define their own logic in their custom form types + probably define it ourselves in all our form types in order to get rid of the default common behavior. Commits ------- 7bfc27e [Form] Add "is empty callback" to form config
…trigger deprecation notices
…ionFailure` method (alanpoulain) This PR was merged into the 3.4 branch. Discussion ---------- [Security] Replace 403 with 401 in `onAuthenticationFailure` method | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A This comment in `onAuthenticationFailure` was misleading since a 401 status code should probably be returned instead of a 403. Commits ------- 73bc793 Replace 403 with 401 in onAuthenticationFailure method
* 3.4: Replace 403 with 401 in onAuthenticationFailure method
…ion and convention to trigger deprecation notices (nicolas-grekas) This PR was merged into the 5.1-dev branch. Discussion ---------- [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR results from a discussion we had yesterday with @alcaeus, @beberlei and others at the Symfony UG meetup in Berlin (thanks SensioLabs for bringing me there). It provides a generic function and convention to trigger deprecation notices, which could be a better alternative to the `@trigger_error(..., E_USER_DEPRECATED)` calls that we use currently. This proposed package would provide a single global function named `deprecated()`. Its purpose is to trigger deprecations in a way that can be silenced on production environment by using the `zend.assertions` ini setting and that can be caught during development to generate reports. The function requires at least 3 arguments: - the name of the package that is triggering the deprecation - the version of the package that introduced the deprecation - the message of the deprecation - more arguments can be provided: they will be inserted in the message using `printf()` formatting Example: ```php deprecated('symfony/blockchain', 8.9, 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); ``` This will generate the following message: `Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` Check symfony#35550 to see how using this function could look like on Symfony itself. Commits ------- f0f41cb [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices
…es (nicolas-grekas) This PR was merged into the 5.1-dev branch. Discussion ---------- [Routing] add priority option to annotated routes | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | yes | Tickets | Fix symfony#26132 | License | MIT | Doc PR | - This PR allows defining the priority of routes using annotations: `@Route(name="foo", priority=10)` As requested [in this comment](symfony#26132 (review)), priority is reserved to using annotations. For other formats, the order works fine. Commits ------- 8522a83 [Routing] add priority option to annotated routes
* 4.4: [Bridge/PhpUnit] fix parse error on PHP5 Replace 403 with 401 in onAuthenticationFailure method
* 5.0: [Bridge/PhpUnit] fix parse error on PHP5 Replace 403 with 401 in onAuthenticationFailure method
* 4.4: [Bridge/PhpUnit] fix compat with recent versions of phpunit
* 5.0: [Bridge/PhpUnit] fix compat with recent versions of phpunit
I did a big mistake when I rebased, I will create a new PR. Sorry |
Hi, It's probably a stupid question, but why this code is not here : https://github.com/symfony/serializer/tree/5.4/Annotation ? (I can't see the file "Since.php", in any version). |
Oh, I see, Thanks ! |
Add Serialization versioning.
@Since
annotation@Until
annotationsince
anduntil
to thexml
andyaml
mappingversion
context option