Skip to content

Commit

Permalink
#8200 - simplify ExistingAtomicStaticCallAnalyzer::hasStaticType()
Browse files Browse the repository at this point in the history
  • Loading branch information
someniatko committed Jul 12, 2022
1 parent ecbceb1 commit 375ba41
Showing 1 changed file with 5 additions and 12 deletions.
Expand Up @@ -628,21 +628,14 @@ private static function getMethodReturnType(
*/
private static function hasStaticInType(Type\TypeNode $type): bool
{
assert($type instanceof Atomic || $type instanceof Union);
$union_parts = $type instanceof Union
? $type->getAtomicTypes()
: [ $type ];
if ($type instanceof TNamedObject && $type->value === 'static') {
return true;
}

foreach ($union_parts as $atomic_type) {
if ($atomic_type instanceof TNamedObject && $atomic_type->value === 'static') {
foreach ($type->getChildNodes() as $child_type) {
if (self::hasStaticInType($child_type)) {
return true;
}

foreach ($atomic_type->getChildNodes() as $child_type) {
if (self::hasStaticInType($child_type)) {
return true;
}
}
}

return false;
Expand Down

0 comments on commit 375ba41

Please sign in to comment.