Skip to content

Commit

Permalink
[TypeDeclaration] Prevent checking class like has external fully qual…
Browse files Browse the repository at this point in the history
…ifieds when class like is null (#319)
  • Loading branch information
zingimmick committed Jun 28, 2021
1 parent dc05658 commit 1a87a3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector\Fixture;

function some_function()
{
}

?>
-----
<?php

namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector\Fixture;

function some_function(): void
{
}

?>
2 changes: 1 addition & 1 deletion rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function hasExclusiveVoid(ClassMethod | Closure | Function_ $functionLike
return false;
}

if ($this->externalFullyQualifiedAnalyzer->hasExternalFullyQualifieds($classLike)) {
if ($classLike instanceof Stmt\Class_ && $this->externalFullyQualifiedAnalyzer->hasExternalFullyQualifieds($classLike)) {
return false;
}

Expand Down

0 comments on commit 1a87a3d

Please sign in to comment.