Skip to content

Commit facfb29

Browse files
minor symfony#61682 Use >= operator in #[RequiresPhp] attributes to allow compatible versions (santysisi)
This PR was merged into the 7.4 branch. Discussion ---------- Use `>=` operator in `#[RequiresPhp]` attributes to allow compatible versions | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | no | License | MIT Updated test attributes to use `#[RequiresPhp('>= 8.x')]` instead of just `#[RequiresPhp('8.x')]` to ensure tests run on PHP 8.x and newer versions. Commits ------- b4496cf Use `>=` operator in `#[RequiresPhp]` attributes to allow compatible versions
2 parents e48850b + b4496cf commit facfb29

File tree

23 files changed

+55
-55
lines changed

23 files changed

+55
-55
lines changed

src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testResetService()
5252
}
5353

5454
#[DataProvider('provideResetServiceWithNativeLazyObjectsCases')]
55-
#[RequiresPhp('8.4')]
55+
#[RequiresPhp('>=8.4')]
5656
public function testResetServiceWithNativeLazyObjects(string $class)
5757
{
5858
$container = new $class();

src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/LazyServiceDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testInvalidClass()
6666
$dumper->getProxyCode($definition);
6767
}
6868

69-
#[RequiresPhp('8.3')]
69+
#[RequiresPhp('>=8.3')]
7070
public function testReadonlyClass()
7171
{
7272
$dumper = new LazyServiceDumper();

src/Symfony/Component/HtmlSanitizer/Tests/Parser/NativeParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Component\HtmlSanitizer\Parser\NativeParser;
1717

18-
#[RequiresPhp('8.4')]
18+
#[RequiresPhp('>=8.4')]
1919
class NativeParserTest extends TestCase
2020
{
2121
public function testParseValid()

src/Symfony/Component/JsonStreamer/Tests/Read/LazyInstantiatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testThrowIfLazyGhostDirNotDefined()
5959
new LazyInstantiator();
6060
}
6161

62-
#[RequiresPhp('8.4')]
62+
#[RequiresPhp('>=8.4')]
6363
public function testCreateLazyGhostUsingPhp()
6464
{
6565
$ghost = (new LazyInstantiator())->instantiate(ClassicDummy::class, function (ClassicDummy $object): void {

src/Symfony/Component/ObjectMapper/Tests/ObjectMapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public function testMapInitializesLazyObject()
403403
$this->assertTrue($lazy->isLazyObjectInitialized());
404404
}
405405

406-
#[RequiresPhp('8.4')]
406+
#[RequiresPhp('>=8.4')]
407407
public function testMapInitializesNativePhp84LazyObject()
408408
{
409409
$initialized = false;

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ private function createUninitializedObjectPropertyGhost(): UninitializedObjectPr
10141014
return (new \ReflectionClass(UninitializedObjectProperty::class))->newLazyGhost(fn () => null);
10151015
}
10161016

1017-
#[RequiresPhp('8.4')]
1017+
#[RequiresPhp('>=8.4')]
10181018
public function testIsWritableWithAsymmetricVisibility()
10191019
{
10201020
$object = new AsymmetricVisibility();
@@ -1026,7 +1026,7 @@ public function testIsWritableWithAsymmetricVisibility()
10261026
$this->assertFalse($this->propertyAccessor->isWritable($object, 'virtualNoSetHook'));
10271027
}
10281028

1029-
#[RequiresPhp('8.4')]
1029+
#[RequiresPhp('>=8.4')]
10301030
public function testIsReadableWithAsymmetricVisibility()
10311031
{
10321032
$object = new AsymmetricVisibility();
@@ -1038,7 +1038,7 @@ public function testIsReadableWithAsymmetricVisibility()
10381038
$this->assertTrue($this->propertyAccessor->isReadable($object, 'virtualNoSetHook'));
10391039
}
10401040

1041-
#[RequiresPhp('8.4')]
1041+
#[RequiresPhp('>=8.4')]
10421042
#[DataProvider('setValueWithAsymmetricVisibilityDataProvider')]
10431043
public function testSetValueWithAsymmetricVisibility(string $propertyPath, ?string $expectedException)
10441044
{

src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ public static function provideLegacyExtractConstructorTypes(): array
696696
];
697697
}
698698

699-
#[RequiresPhp('8.4')]
699+
#[RequiresPhp('>=8.4')]
700700
public function testAsymmetricVisibility()
701701
{
702702
$this->assertTrue($this->extractor->isReadable(AsymmetricVisibility::class, 'publicPrivate'));
@@ -707,7 +707,7 @@ public function testAsymmetricVisibility()
707707
$this->assertFalse($this->extractor->isWritable(AsymmetricVisibility::class, 'protectedPrivate'));
708708
}
709709

710-
#[RequiresPhp('8.4')]
710+
#[RequiresPhp('>=8.4')]
711711
public function testAsymmetricVisibilityAllowPublicOnly()
712712
{
713713
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PUBLIC);
@@ -720,7 +720,7 @@ public function testAsymmetricVisibilityAllowPublicOnly()
720720
$this->assertFalse($extractor->isWritable(AsymmetricVisibility::class, 'protectedPrivate'));
721721
}
722722

723-
#[RequiresPhp('8.4')]
723+
#[RequiresPhp('>=8.4')]
724724
public function testAsymmetricVisibilityAllowProtectedOnly()
725725
{
726726
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PROTECTED);
@@ -733,7 +733,7 @@ public function testAsymmetricVisibilityAllowProtectedOnly()
733733
$this->assertFalse($extractor->isWritable(AsymmetricVisibility::class, 'protectedPrivate'));
734734
}
735735

736-
#[RequiresPhp('8.4')]
736+
#[RequiresPhp('>=8.4')]
737737
public function testAsymmetricVisibilityAllowPrivateOnly()
738738
{
739739
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PRIVATE);
@@ -746,7 +746,7 @@ public function testAsymmetricVisibilityAllowPrivateOnly()
746746
$this->assertTrue($extractor->isWritable(AsymmetricVisibility::class, 'protectedPrivate'));
747747
}
748748

749-
#[RequiresPhp('8.4')]
749+
#[RequiresPhp('>=8.4')]
750750
public function testVirtualProperties()
751751
{
752752
$this->assertTrue($this->extractor->isReadable(VirtualProperties::class, 'virtualNoSetHook'));
@@ -758,7 +758,7 @@ public function testVirtualProperties()
758758
}
759759

760760
#[DataProvider('provideAsymmetricVisibilityMutator')]
761-
#[RequiresPhp('8.4')]
761+
#[RequiresPhp('>=8.4')]
762762
public function testAsymmetricVisibilityMutator(string $property, string $readVisibility, string $writeVisibility)
763763
{
764764
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PUBLIC | ReflectionExtractor::ALLOW_PROTECTED | ReflectionExtractor::ALLOW_PRIVATE);
@@ -781,7 +781,7 @@ public static function provideAsymmetricVisibilityMutator(): iterable
781781
}
782782

783783
#[DataProvider('provideVirtualPropertiesMutator')]
784-
#[RequiresPhp('8.4')]
784+
#[RequiresPhp('>=8.4')]
785785
public function testVirtualPropertiesMutator(string $property, string $readVisibility, string $writeVisibility)
786786
{
787787
$extractor = new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PUBLIC | ReflectionExtractor::ALLOW_PROTECTED | ReflectionExtractor::ALLOW_PRIVATE);

src/Symfony/Component/Security/Http/Tests/EventListener/IsGrantedAttributeWithClosureListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use Symfony\Component\Security\Http\Tests\Fixtures\IsGrantedAttributeMethodsWithClosureController;
2929
use Symfony\Component\Security\Http\Tests\Fixtures\IsGrantedAttributeWithClosureController;
3030

31-
#[RequiresPhp('8.5')]
31+
#[RequiresPhp('>=8.5')]
3232
class IsGrantedAttributeWithClosureListenerTest extends TestCase
3333
{
3434
public function testAttribute()

src/Symfony/Component/Serializer/Tests/Normalizer/NumberNormalizerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static function supportsNormalizationProvider(): iterable
5252
yield 'null' => [null, false];
5353
}
5454

55-
#[RequiresPhp('8.4')]
55+
#[RequiresPhp('>=8.4')]
5656
#[RequiresPhpExtension('bcmath')]
5757
#[DataProvider('normalizeGoodBcMathNumberValueProvider')]
5858
public function testNormalizeBcMathNumber(Number $data, string $expected)
@@ -100,7 +100,7 @@ public static function normalizeBadValueProvider(): iterable
100100
yield 'null' => [null];
101101
}
102102

103-
#[RequiresPhp('8.4')]
103+
#[RequiresPhp('>=8.4')]
104104
#[RequiresPhpExtension('bcmath')]
105105
public function testSupportsBcMathNumberDenormalization()
106106
{
@@ -118,7 +118,7 @@ public function testDoesNotSupportOtherValuesDenormalization()
118118
$this->assertFalse($this->normalizer->supportsDenormalization(null, \stdClass::class));
119119
}
120120

121-
#[RequiresPhp('8.4')]
121+
#[RequiresPhp('>=8.4')]
122122
#[RequiresPhpExtension('bcmath')]
123123
#[DataProvider('denormalizeGoodBcMathNumberValueProvider')]
124124
public function testDenormalizeBcMathNumber(string|int $data, string $type, Number $expected)
@@ -150,7 +150,7 @@ public static function denormalizeGoodGmpValueProvider(): iterable
150150
}
151151
}
152152

153-
#[RequiresPhp('8.4')]
153+
#[RequiresPhp('>=8.4')]
154154
#[RequiresPhpExtension('bcmath')]
155155
#[DataProvider('denormalizeBadBcMathNumberValueProvider')]
156156
public function testDenormalizeBadBcMathNumberValueThrows(mixed $data, string $type, string $expectedException, string $expectedExceptionMessage)

src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function testDenormalizeWithReadOnlyClass()
192192
$this->assertSame('childProp', $object->childProp);
193193
}
194194

195-
#[RequiresPhp('8.4')]
195+
#[RequiresPhp('>=8.4')]
196196
public function testDenormalizeWithAsymmetricPropertyVisibility()
197197
{
198198
/** @var SpecialBookDummy $object */

0 commit comments

Comments
 (0)