Skip to content

Commit

Permalink
[Php81] Skip possible array on NullToStrictStringFuncCallArgRector (#…
Browse files Browse the repository at this point in the history
…5587)

* [Php81] Skip possible array on NullToStrictStringFuncCallArgRector

* [Php81] Skip possible array on NullToStrictStringFuncCallArgRector
  • Loading branch information
samsonasik authored Feb 8, 2024
1 parent 2194c6e commit 178ce5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Rector\Tests\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector\Fixture;

final class SkipPossibleArray
{
public function run(string|array|null $value): array|string
{
return str_replace('for', 'bar', $value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private function shouldSkipType(Type $type): bool
{
return ! $type instanceof MixedType &&
! $type instanceof NullType &&
! ($type instanceof UnionType && $this->unionTypeAnalyzer->isNullable($type));
! ($type instanceof UnionType && $this->unionTypeAnalyzer->isNullable($type, true));
}

private function shouldSkipTrait(Expr $expr, Type $type, bool $isTrait): bool
Expand Down

0 comments on commit 178ce5c

Please sign in to comment.