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
Prepare PHP 8 compatibility #5813
Prepare PHP 8 compatibility #5813
Conversation
@@ -54,7 +54,7 @@ public function provide($entity, $name) | |||
$locale = $this->translator->getLocale(); | |||
|
|||
try { | |||
if (\method_exists($entity, 'getLocale')) { | |||
if (\is_object($entity) && \method_exists($entity, 'getLocale')) { |
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.
@@ -214,7 +214,7 @@ protected function processPut($entities, $requestEntities, $deleteCallback, $upd | |||
// FIXME: this is just a hack to avoid relations that start with index != 0 | |||
// FIXME: otherwise deserialization process will parse relations as object instead of an array | |||
// reindex entities | |||
if (\count($entities) > 0 && \method_exists($entities, 'getValues')) { | |||
if (\count($entities) > 0 && \is_object($entities) && \method_exists($entities, 'getValues')) { |
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.
@@ -250,7 +250,8 @@ public function extractSnippetTypeFromPath($path) | |||
$newPath = PathHelper::getParentPath($path); | |||
$newPath = \substr($newPath, \strlen($snippetsPath)); | |||
|
|||
if (false === $newPath) { | |||
// $newPath can be false or empty because of return difference of substr depending on php version (<= 7.4, 8.0) | |||
if (!$newPath) { |
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.
@@ -105,16 +105,26 @@ public function provideSortObjects() | |||
'[foo]', ['2', '1', '3'], | |||
], | |||
|
|||
// multi dimensional array missing key | |||
// multi dimensional array missing key asc |
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.
See also https://3v4l.org/LsUj7
What's in this PR?
Add PHP 8 compatibility
Why?
This fixes codes which are needed for the PHP 8 compatibility to be changed. See also #5757