mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-21 18:42:24 +00:00
[PHP 5.5] Prevent error on non-string value in PregReplaceEModifierRector
This commit is contained in:
parent
47a19ac620
commit
b113c38670
|
@ -87,7 +87,12 @@ PHP
|
|||
return null;
|
||||
}
|
||||
|
||||
$pattern = $this->getValue($node->args[0]->value);
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
if (! $firstArgumentValue instanceof String_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$pattern = $this->getValue($firstArgumentValue);
|
||||
$delimiter = $pattern[0];
|
||||
|
||||
/** @var string $modifiers */
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Php55\Tests\Rector\FuncCall\PregReplaceEModifierRector\Fixture;
|
||||
|
||||
class SkipNonString
|
||||
{
|
||||
public function run($contents)
|
||||
{
|
||||
$contents = preg_replace(['/\s+$/Sm', '/\n+/S'], "\n", $contents);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user