From 51802c03911de092189816aff37e6e6614f15630 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Tue, 26 Aug 2025 08:26:01 -0500 Subject: [PATCH] fix: skip scope method that is not a scope --- ...akeModelAttributesAndScopesProtectedRector.php | 2 +- .../Fixture/skip_scope_method_not_scope.php.inc | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector/Fixture/skip_scope_method_not_scope.php.inc diff --git a/src/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector.php b/src/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector.php index 51e49f5dc..7f8666bb1 100644 --- a/src/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector.php +++ b/src/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector.php @@ -136,7 +136,7 @@ private function isScopeMethod(ClassMethod $classMethod): bool { $name = $this->getName($classMethod); - if (str_starts_with((string) $name, 'scope')) { + if ((bool) preg_match('/^scope.+$/', $name)) { return true; } diff --git a/tests/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector/Fixture/skip_scope_method_not_scope.php.inc b/tests/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector/Fixture/skip_scope_method_not_scope.php.inc new file mode 100644 index 000000000..da1d55f8b --- /dev/null +++ b/tests/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector/Fixture/skip_scope_method_not_scope.php.inc @@ -0,0 +1,15 @@ +