Skip to content

Commit 2da2b18

Browse files
committed
minor #2251 ensure compatibility with PHP 8 (xabbuh)
This PR was merged into the 2.x branch. Discussion ---------- ensure compatibility with PHP 8 fixes #2250 Commits ------- 4e851f3 ensure compatibility with PHP 8
2 parents 5a8675e + 4e851f3 commit 2da2b18

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ matrix:
2828
# development dependencies
2929
- php: 7.4
3030
env: DEPENDENCIES='dev'
31+
- php: nightly
32+
env: COMPOSER_FLAGS="--ignore-platform-reqs" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
3133
allow_failures:
3234
- php: 7.4
3335
env: DEPENDENCIES='dev'

EventListener/ParamFetcherListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function onKernelController($event)
4949

5050
$controller = $event->getController();
5151

52-
if (is_callable($controller) && method_exists($controller, '__invoke')) {
52+
if (is_callable($controller) && (is_object($controller) || is_string($controller)) && method_exists($controller, '__invoke')) {
5353
$controller = [$controller, '__invoke'];
5454
}
5555

Routing/Loader/Reader/RestActionReader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,9 @@ private function getMethodArguments(\ReflectionMethod $method): array
467467
continue;
468468
}
469469

470-
$argumentClass = $argument->getClass();
471-
if ($argumentClass) {
472-
$className = $argumentClass->getName();
470+
$argumentClass = $argument->getType();
471+
if ($argumentClass && !$argumentClass->isBuiltIn()) {
472+
$className = method_exists($argumentClass, 'getName') ? $argumentClass->getName() : (string) $argumentClass;
473473
foreach ($this->getIgnoredClasses() as $class) {
474474
if ($className === $class || is_subclass_of($className, $class)) {
475475
continue 2;

Tests/Request/RequestBodyParamConverterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp(): void
4444
],
4545
'configuration'
4646
);
47-
if (ParamConverter::class != $parameter->getClass()->getName()) {
47+
if (ParamConverter::class != $parameter->getType()->getName()) {
4848
$this->markTestSkipped(
4949
'skipping RequestBodyParamConverterTest due to an incompatible version of the SensioFrameworkExtraBundle'
5050
);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
]
3030
},
3131
"require": {
32-
"php": "^7.1",
32+
"php": "^7.1|^8.0",
3333
"psr/log": "^1.0",
3434
"symfony/config": "^3.4|^4.3",
3535
"symfony/debug": "^3.4|^4.3",

0 commit comments

Comments
 (0)