mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Use less obscure method for checking a string against many other strings
This commit is contained in:
parent
e6d9854883
commit
10a90d2270
@ -663,6 +663,9 @@ class MethodChecker extends FunctionLikeChecker
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that __clone, __construct, and __destruct do not have a return type
|
||||
* hint in their signature.
|
||||
*
|
||||
* @param MethodStorage $method_storage
|
||||
* @param CodeLocation $code_location
|
||||
* @return false|null
|
||||
@ -676,10 +679,8 @@ class MethodChecker extends FunctionLikeChecker
|
||||
}
|
||||
|
||||
$cased_method_name = $method_storage->cased_name;
|
||||
switch ($cased_method_name) {
|
||||
case '__clone':
|
||||
case '__construct':
|
||||
case '__destruct':
|
||||
$methodsOfInterest = ['__clone', '__construct', '__destruct'];
|
||||
if (in_array($cased_method_name, $methodsOfInterest)) {
|
||||
if (IssueBuffer::accepts(
|
||||
new MethodSignatureMustOmitReturnType(
|
||||
'Method ' . $cased_method_name . ' must not declare a return type',
|
||||
@ -688,8 +689,8 @@ class MethodChecker extends FunctionLikeChecker
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user