forked from rectorphp/rector-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert removed ErrorType handling on NullToStrictStringFuncCallArgRec…
…tor (rectorphp#4793)
- Loading branch information
1 parent
514df0a
commit d8d4e8d
Showing
3 changed files
with
62 additions
and
48 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
...1/Rector/FuncCall/NullToStrictStringFuncCallArgRector/Fixture/preg_match_callable.php.inc
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
...Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector/Fixture/skip_error_type.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,27 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector\Fixture; | ||
|
||
use Nette\Utils\Strings; | ||
|
||
final class SkipErrorType | ||
{ | ||
public function run($regex) | ||
{ | ||
Strings::replace('value', $regex, function (array $match) use ( | ||
&$string | ||
): string { | ||
$innerPattern = $match['content']; | ||
$positionDelimiter = strpos($innerPattern, $this->delimiter); | ||
|
||
if ($positionDelimiter > 0) { | ||
$innerPattern = str_replace($this->delimiter, '\\' . $this->delimiter, $innerPattern); | ||
} | ||
|
||
// change delimiter | ||
if (strlen($innerPattern) > 2 && $innerPattern[0] === $innerPattern[strlen($innerPattern) - 1]) { | ||
return 'foo'; | ||
} | ||
}); | ||
} | ||
} |
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