From dc967efa34109cfafcce6b4ad46536bcdb998601 Mon Sep 17 00:00:00 2001 From: Aleksei Kankov Date: Thu, 14 May 2026 21:04:50 +0200 Subject: [PATCH 1/2] [PHPUnit12] Add fixture reproducing AllowMockObjects false positive on ConstraintValidatorTestCase Refs rectorphp/rector#9650 --- .../skip_constraint_validator_test_case.php.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case.php.inc diff --git a/rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case.php.inc b/rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case.php.inc new file mode 100644 index 00000000..2c5393a1 --- /dev/null +++ b/rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case.php.inc @@ -0,0 +1,10 @@ + Date: Thu, 14 May 2026 21:04:50 +0200 Subject: [PATCH 2/2] [PHPUnit12] Drop ConstraintValidatorTestCase from AllowMockObjectsWhereParentClassRector triggers The Symfony fix in symfony/symfony#62745 (shipped in symfony/validator 6.4.31 / 7.3.9 / 7.4.3 / 8.0.3) removed the underlying need for the attribute on this lineage. Rule now fires only on TypeTestCase. Includes: code sample updated to TypeTestCase, orphaned enum constant removed, existing fixture converted to TypeTestCase, stub added so the converted fixture autoloads, and a transitive-inheritance skip fixture. Closes rectorphp/rector#9650 --- ...nt_validator_test_case_via_intermediate.php.inc | 14 ++++++++++++++ .../Fixture/some_class.php.inc | 8 ++++---- .../AllowMockObjectsWhereParentClassRector.php | 13 +++++-------- src/Enum/PHPUnitClassName.php | 2 -- stubs/Symfony/Component/Form/Test/TypeTestCase.php | 9 +++++++++ 5 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case_via_intermediate.php.inc create mode 100644 stubs/Symfony/Component/Form/Test/TypeTestCase.php diff --git a/rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case_via_intermediate.php.inc b/rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case_via_intermediate.php.inc new file mode 100644 index 00000000..ae71a3ac --- /dev/null +++ b/rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWhereParentClassRector/Fixture/skip_constraint_validator_test_case_via_intermediate.php.inc @@ -0,0 +1,14 @@ +