-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Lock] Add LockKeyNormalizer
#60023
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
base: 7.4
Are you sure you want to change the base?
[Lock] Add LockKeyNormalizer
#60023
Conversation
89d05b7
to
d1cd6e1
Compare
{ | ||
$key = (new \ReflectionClass(Key::class))->newInstanceWithoutConstructor(); | ||
foreach ($key->__sleep() as $serializedField) { | ||
(fn () => $this->$serializedField = $data[$serializedField])->bindTo($key, Key::class)(); |
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.
it should be more efficient to have one closure outside of the loop instead of many calls inside
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, done.
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.
Read your comment again after 4 months – the loop is now inside the closure 👍 😄
src/Symfony/Component/Lock/Tests/Serializer/LockKeyNormalizerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
@@ -5,6 +5,7 @@ CHANGELOG | |||
--- | |||
|
|||
* Add support for `valkey:` / `valkeys:` schemes | |||
* Add `LockKeyNormalizer` |
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 this be on a new 7.4 section?
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.
it should indeed be in a 7.4 section
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.
Fixed
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; | ||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; | ||
|
||
class LockKeyNormalizer implements NormalizerInterface, DenormalizerInterface |
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.
Maybe add @auhor and a description?
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.
Sure, done
The Lock documentation mentions that the lock keys are serializable – however, it seems that's the case only if you're using native php serializer.
I'm proposing to add
LockKeyNormalizer
to make the example in the docs work the same when using Symfony Serializer too.