diff --git a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_compare_context.php.inc b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_compare_context.php.inc index c58b51445..9b3f4ee90 100644 --- a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_compare_context.php.inc +++ b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_compare_context.php.inc @@ -2,7 +2,9 @@ namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class AssertCompareContext +use Behat\Behat\Context\Context; + +final class AssertCompareContext implements Context { public function some($response) { @@ -17,7 +19,9 @@ final class AssertCompareContext namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class AssertCompareContext +use Behat\Behat\Context\Context; + +final class AssertCompareContext implements Context { public function some($response) { diff --git a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_null_compare_context.php.inc b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_null_compare_context.php.inc index f2c349651..3330f3291 100644 --- a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_null_compare_context.php.inc +++ b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/assert_null_compare_context.php.inc @@ -2,7 +2,9 @@ namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class AssertNullCompareContext +use Behat\Behat\Context\Context; + +final class AssertNullCompareContext implements Context { public function some($response) { @@ -16,7 +18,9 @@ final class AssertNullCompareContext namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class AssertNullCompareContext +use Behat\Behat\Context\Context; + +final class AssertNullCompareContext implements Context { public function some($response) { diff --git a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/method_exists_context.php.inc b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/method_exists_context.php.inc index 59edebfa0..971739146 100644 --- a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/method_exists_context.php.inc +++ b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/method_exists_context.php.inc @@ -2,7 +2,9 @@ namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class MethodExistsContext +use Behat\Behat\Context\Context; + +final class MethodExistsContext implements Context { public function some($response) { @@ -16,7 +18,9 @@ final class MethodExistsContext namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class MethodExistsContext +use Behat\Behat\Context\Context; + +final class MethodExistsContext implements Context { public function some($response) { diff --git a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/simple_context.php.inc b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/simple_context.php.inc index 8c16d4857..96abbb26d 100644 --- a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/simple_context.php.inc +++ b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/simple_context.php.inc @@ -2,7 +2,9 @@ namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class SimpleContext +use Behat\Behat\Context\Context; + +final class SimpleContext implements Context { public function some($response) { @@ -18,7 +20,9 @@ final class SimpleContext namespace Rector\PHPUnit\Tests\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector\Fixture; -final class SimpleContext +use Behat\Behat\Context\Context; + +final class SimpleContext implements Context { public function some($response) { diff --git a/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/skip_non_behat_context_class.php.inc b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/skip_non_behat_context_class.php.inc new file mode 100644 index 000000000..15944442d --- /dev/null +++ b/rules-tests/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector/Fixture/skip_non_behat_context_class.php.inc @@ -0,0 +1,11 @@ +getClassReflection() instanceof ClassReflection) { + $classReflection = $scope->getClassReflection(); + if (! $classReflection instanceof ClassReflection) { return false; } - $className = $scope->getClassReflection() - ->getName(); - // special case with static call - return str_ends_with($className, 'Context'); + return $classReflection->is(BehatClassName::CONTEXT); } /**