Skip to content

Commit 2e0c872

Browse files
minor #41295 Remove constraint for PHP < 8 (jderusse)
This PR was squashed before being merged into the 6.0 branch. Discussion ---------- Remove constraint for PHP < 8 | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Remove code check against PHP_VERSION < 8 (except for PHPUnit Bridge) Commits ------- a8c74ae3fb Remove constraint for PHP < 8
2 parents 1cca375 + 10f175d commit 2e0c872

File tree

4 files changed

+3
-21
lines changed

4 files changed

+3
-21
lines changed

Loader/AnnotationClassLoader.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected function getGlobals(\ReflectionClass $class)
280280
$globals = $this->resetGlobals();
281281

282282
$annot = null;
283-
if (\PHP_VERSION_ID >= 80000 && ($attribute = $class->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null)) {
283+
if ($attribute = $class->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null) {
284284
$annot = $attribute->newInstance();
285285
}
286286
if (!$annot && $this->reader) {
@@ -371,10 +371,8 @@ abstract protected function configureRoute(Route $route, \ReflectionClass $class
371371
*/
372372
private function getAnnotations(object $reflection): iterable
373373
{
374-
if (\PHP_VERSION_ID >= 80000) {
375-
foreach ($reflection->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
376-
yield $attribute->newInstance();
377-
}
374+
foreach ($reflection->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
375+
yield $attribute->newInstance();
378376
}
379377

380378
if (!$this->reader) {

Tests/Annotation/RouteTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public function testDeprecationArrayAsFirstArgument(string $parameter, $value, s
7171
}
7272

7373
/**
74-
* @requires PHP 8
7574
* @dataProvider getValidParameters
7675
*/
7776
public function testLoadFromAttribute(string $methodName, string $getter, $expectedReturn)

Tests/Loader/AnnotationClassLoaderWithAttributesTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
use Symfony\Component\Routing\Loader\AnnotationClassLoader;
66
use Symfony\Component\Routing\Route;
77

8-
/**
9-
* @requires PHP 8
10-
*/
118
class AnnotationClassLoaderWithAttributesTest extends AnnotationClassLoaderTest
129
{
1310
protected function setUp(string $env = null): void

Tests/Loader/AnnotationFileLoaderTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ public function testSupports()
8686
$this->assertFalse($this->loader->supports($fixture, 'foo'), '->supports() checks the resource type if specified');
8787
}
8888

89-
/**
90-
* @requires PHP 8
91-
*/
9289
public function testLoadAttributesClassAfterComma()
9390
{
9491
$this->reader->expects($this->once())->method('getClassAnnotation');
@@ -103,9 +100,6 @@ public function testLoadAttributesInlineClassAfterComma()
103100
$this->loader->load(__DIR__.'/../Fixtures/AttributesFixtures/AttributesClassParamInlineAfterCommaController.php');
104101
}
105102

106-
/**
107-
* @requires PHP 8
108-
*/
109103
public function testLoadAttributesQuotedClassAfterComma()
110104
{
111105
$this->reader->expects($this->once())->method('getClassAnnotation');
@@ -120,9 +114,6 @@ public function testLoadAttributesInlineQuotedClassAfterComma()
120114
$this->loader->load(__DIR__.'/../Fixtures/AttributesFixtures/AttributesClassParamInlineQuotedAfterCommaController.php');
121115
}
122116

123-
/**
124-
* @requires PHP 8
125-
*/
126117
public function testLoadAttributesClassAfterParenthesis()
127118
{
128119
$this->reader->expects($this->once())->method('getClassAnnotation');
@@ -137,9 +128,6 @@ public function testLoadAttributesInlineClassAfterParenthesis()
137128
$this->loader->load(__DIR__.'/../Fixtures/AttributesFixtures/AttributesClassParamInlineAfterParenthesisController.php');
138129
}
139130

140-
/**
141-
* @requires PHP 8
142-
*/
143131
public function testLoadAttributesQuotedClassAfterParenthesis()
144132
{
145133
$this->reader->expects($this->once())->method('getClassAnnotation');

0 commit comments

Comments
 (0)