Skip to content

Commit e2421b7

Browse files
committed
Polyfills 8.4/8.5: remove overzealous exclusion
I already annotated when I added these attribute related exclusions that they weren't targeted enough and ran the risk of blanket ignoring more than we should. I've now decided to remove these as the excludes are too risky, meaning that end-users may end up missing legitimate PHP cross-version compatibility issues because of it. This highlights that more needs to change in how attributes are detected and flagged in PHPCompatibility itself. Once that improvement is made, these tests should be re-enabled and more targeted excludes should be added. Also see 74, which I have opened as a follow-up to this PR.
1 parent b833854 commit e2421b7

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

PHPCompatibilitySymfonyPolyfillPHP84/ruleset.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
<!--
2525
Detection for the Deprecated attribute is incomplete in PHPCompatibility 10.0.0-alpha1.
2626
Handling for this should be added once the detection implementation is known.
27-
The following exclude is a temporary placeholder, which should be removed as soon as
28-
possible as it will ignore too much.
2927
-->
30-
<exclude name="PHPCompatibility.Attributes.NewAttributes.PHPStormAttributeFound"/>
3128

3229
<exclude name="PHPCompatibility.Classes.NewClasses.reflectionconstantFound"/>
3330
</rule>

PHPCompatibilitySymfonyPolyfillPHP85/ruleset.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
<!--
1515
Detection for the DelayedTargetValidation and NoDiscard attributes is incomplete in PHPCompatibility 10.0.0-alpha1.
1616
This section should be filled out once the detection implementation is known.
17-
The following exclude is a temporary placeholder, which should be removed as soon as
18-
possible as it will ignore too much.
1917
-->
20-
<exclude name="PHPCompatibility.Attributes.NewAttributes.Found"/>
2118
</rule>
2219

2320
<!-- Prevent false positives being thrown when run over the code of polyfill-php84 itself. -->

Test/SymfonyPolyfillPHP84Test.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424

2525
$r = new ReflectionConstant(ClassName::CONSTANT_NAME);
2626

27+
/*
28+
// This test will not help at this time as we can't just ignore the use of the Deprecated attribute
29+
// with the current attribute handling in PHPCompatibility 10.0.
2730
#[Deprecated]
2831
function foo() {}
32+
*/

Test/SymfonyPolyfillPHP85Test.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
array_first($array);
99
array_last($array);
1010

11+
/*
12+
// This test will not help at this time as we can't just ignore the use of the DelayedTargetValidation/NoDiscard attribute
13+
// with the current attribute handling in PHPCompatibility 10.0.
1114
#[DelayedTargetValidation]
1215
#[NoDiscard]
1316
function dummy() {}
17+
*/

0 commit comments

Comments
 (0)