Skip to content

Commit 4273c16

Browse files
Add some symfony/polyfill support (#7965)
* Add some symfony/polyfill support * added constants --------- Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
1 parent dcc3c8c commit 4273c16

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
use Rector\Rector\AbstractRector;
3030
use Rector\ValueObject\MethodName;
3131
use Rector\ValueObject\PhpVersionFeature;
32+
use Rector\ValueObject\PolyfillPackage;
3233
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
34+
use Rector\VersionBonding\Contract\RelatedPolyfillInterface;
3335
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
3436
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
3537

@@ -38,7 +40,7 @@
3840
*
3941
* @see \Rector\Tests\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector\AddOverrideAttributeToOverriddenMethodsRectorTest
4042
*/
41-
final class AddOverrideAttributeToOverriddenMethodsRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface
43+
final class AddOverrideAttributeToOverriddenMethodsRector extends AbstractRector implements MinPhpVersionInterface, RelatedPolyfillInterface, ConfigurableRectorInterface
4244
{
4345
/**
4446
* @api
@@ -226,6 +228,11 @@ public function provideMinPhpVersion(): int
226228
return PhpVersionFeature::OVERRIDE_ATTRIBUTE;
227229
}
228230

231+
public function providePolyfillPackage(): string
232+
{
233+
return PolyfillPackage::PHP_83;
234+
}
235+
229236
/**
230237
* @param ClassReflection[] $parentClassReflections
231238
*/

rules/Php84/Rector/Class_/DeprecatedAnnotationToDeprecatedAttributeRector.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
use Rector\PhpAttribute\DeprecatedAnnotationToDeprecatedAttributeConverter;
1212
use Rector\Rector\AbstractRector;
1313
use Rector\ValueObject\PhpVersionFeature;
14+
use Rector\ValueObject\PolyfillPackage;
1415
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
16+
use Rector\VersionBonding\Contract\RelatedPolyfillInterface;
1517
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1618
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
1719

1820
/**
1921
* @see \Rector\Tests\Php84\Rector\Class_\DeprecatedAnnotationToDeprecatedAttributeRector\DeprecatedAnnotationToDeprecatedAttributeRectorTest
2022
*/
21-
final class DeprecatedAnnotationToDeprecatedAttributeRector extends AbstractRector implements MinPhpVersionInterface
23+
final class DeprecatedAnnotationToDeprecatedAttributeRector extends AbstractRector implements MinPhpVersionInterface, RelatedPolyfillInterface
2224
{
2325
public function __construct(
2426
private readonly DeprecatedAnnotationToDeprecatedAttributeConverter $deprecatedAnnotationToDeprecatedAttributeConverter,
@@ -65,4 +67,9 @@ public function provideMinPhpVersion(): int
6567
{
6668
return PhpVersionFeature::DEPRECATED_ATTRIBUTE;
6769
}
70+
71+
public function providePolyfillPackage(): string
72+
{
73+
return PolyfillPackage::PHP_84;
74+
}
6875
}

src/ValueObject/PolyfillPackage.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@
99
*/
1010
final class PolyfillPackage
1111
{
12+
public const string PHP_85 = 'symfony/polyfill-php85';
13+
14+
public const string PHP_84 = 'symfony/polyfill-php84';
15+
1216
public const string PHP_83 = 'symfony/polyfill-php83';
1317

18+
public const string PHP_82 = 'symfony/polyfill-php82';
19+
20+
public const string PHP_81 = 'symfony/polyfill-php81';
21+
1422
public const string PHP_80 = 'symfony/polyfill-php80';
1523

1624
public const string PHP_73 = 'symfony/polyfill-php73';

0 commit comments

Comments
 (0)