Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NodeTypeResolver] Use Scope->getType() on ArrayDimFetch on NodeTypeR…
…esolver::getNativeType() (#5037) * [NodeTypeResolver] Use Scope->getType() on ArrayDimFetch on NodeTypeResolver::getNativeType() * Fix * Fix * final touch: more clear usage of ArrayDimFetch on empty * add array dim fetch from docblock
- Loading branch information
1 parent
308178a
commit a3d2fcd
Showing
3 changed files
with
73 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/Issues/EmptyBooleanCompare/Fixture/array_dim_fetch_from_docblock.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\EmptyBooleanCompare\Fixture; | ||
|
||
final class ArrayDimFetchFromDocblock | ||
{ | ||
/** | ||
* @param array{host: string} $parts | ||
*/ | ||
public function checkUrl(array $parts) | ||
{ | ||
if (!empty($parts['host'])) { | ||
return $parts['host']; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\EmptyBooleanCompare\Fixture; | ||
|
||
final class ArrayDimFetchFromDocblock | ||
{ | ||
/** | ||
* @param array{host: string} $parts | ||
*/ | ||
public function checkUrl(array $parts) | ||
{ | ||
if (isset($parts['host']) && $parts['host'] !== '') { | ||
return $parts['host']; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
?> |