Skip to content

Commit ca7f043

Browse files
committed
HPB-4005 simplify checking the blacklist
1 parent 57b46f6 commit ca7f043

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

src/Rules/ScopeRequestValidateMethods.php

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,21 @@ private function processMethod(array $method): Collection
9696

9797
private function isBlacklisted(string $methodName): bool
9898
{
99-
if ($methodName === 'only') {
100-
return true;
101-
}
102-
103-
if ($methodName === 'input') {
104-
return true;
105-
}
106-
107-
if ($methodName === 'get') {
108-
return true;
109-
}
110-
111-
if ($methodName === 'string') {
112-
return true;
113-
}
114-
115-
if ($methodName === 'integer') {
116-
return true;
117-
}
118-
119-
if ($methodName === 'boolean') {
120-
return true;
121-
}
99+
$blacklistedMethodNames = [
100+
'collect',
101+
'all',
102+
'only',
103+
'except',
104+
'input',
105+
'get',
106+
'keys',
107+
'string',
108+
'str',
109+
'integer',
110+
'float',
111+
'boolean',
112+
];
122113

123-
return false;
114+
return in_array($methodName, $blacklistedMethodNames, strict: true);
124115
}
125116
}

0 commit comments

Comments
 (0)