-
Notifications
You must be signed in to change notification settings - Fork 5
Code optimisations for PHP8 #45
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
Conversation
@@ -227,7 +227,7 @@ public function unlock(Request $request): bool | |||
|
|||
try { | |||
$this->locks[$cacheKey]->release(); | |||
} catch (LockReleasingException $e) { |
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.
@@ -100,7 +100,7 @@ public function __construct(array $options = []) | |||
$this->options = $resolver->resolve($options); | |||
$this->cache = $this->options['cache']; | |||
$this->lockFactory = $this->options['lock_factory']; | |||
$this->hashAlgorithm = version_compare(PHP_VERSION, '8.1.0', '>=') ? 'xxh128' : 'sha256'; | |||
$this->hashAlgorithm = \PHP_VERSION_ID >= 80100 ? 'xxh128' : 'sha256'; |
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 expression is evaluated by the compiler.
@@ -508,13 +508,13 @@ private function restoreResponse(array $cacheData): ?Response | |||
|
|||
// BC | |||
if (\is_string($value)) { | |||
$value = ['expires' => 0, 'contents' => $value]; |
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 key expires
is not used.
LGTM, wdyt @alexander-schranz? |
Looks fine from my side the only case I have not enough knowledge about is the deletion of |
That's indeed not needed :) Thanks @GromNaN - released as 4.1.1: https://github.com/Toflar/psr6-symfony-http-cache-store/releases/tag/4.1.1 |
I'd like to propose this minor changes, mostly suggested by PHPStorm.