mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
apply on self
This commit is contained in:
parent
42e4454b48
commit
495ace61c6
@ -94,7 +94,11 @@ PHP
|
||||
}
|
||||
|
||||
// is suffix in the same category, e.g. "Exception/SomeException.php"
|
||||
$expectedLocationFilePattern = sprintf('#\/%s\/.+%s#', preg_quote($groupName), preg_quote($suffixPattern));
|
||||
$expectedLocationFilePattern = sprintf(
|
||||
'#\/%s\/.+%s#',
|
||||
preg_quote($groupName, '#'),
|
||||
preg_quote($suffixPattern, '#')
|
||||
);
|
||||
if (Strings::match($smartFileInfo->getRealPath(), $expectedLocationFilePattern)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ final class ClassAnnotationMatcher
|
||||
private function isUseMatchingName(string $tag, UseUse $useUse): bool
|
||||
{
|
||||
$shortName = $useUse->alias ? $useUse->alias->name : $useUse->name->getLast();
|
||||
$shortNamePattern = preg_quote($shortName);
|
||||
$shortNamePattern = preg_quote($shortName, '#');
|
||||
|
||||
return (bool) Strings::match($tag, '#' . $shortNamePattern . '(\\\\[\w]+)?#i');
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
@ -65,7 +67,7 @@ PHP
|
||||
return null;
|
||||
}
|
||||
|
||||
$node->args[1] = new Node\Arg(new Node\Scalar\String_('#'));
|
||||
$node->args[1] = new Arg(new String_('#'));
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
@ -197,8 +197,8 @@ final class DocBlockNameImporter
|
||||
// short with space " Type"| fqn
|
||||
$shortNameOrFullyQualifiedNamePattern = sprintf(
|
||||
'#(\s%s\b|\b%s\b)#',
|
||||
preg_quote($shortenedObjectType->getShortName()),
|
||||
preg_quote($fullyQualifiedName)
|
||||
preg_quote($shortenedObjectType->getShortName(), '#'),
|
||||
preg_quote($fullyQualifiedName, '#')
|
||||
);
|
||||
|
||||
$isShortClassUsed = (bool) Strings::match($printedClass, $shortNameOrFullyQualifiedNamePattern);
|
||||
|
@ -248,7 +248,7 @@ PHP
|
||||
if ($methodCall->args[0]->value instanceof String_) {
|
||||
/** @var String_ $oldString */
|
||||
$oldString = $methodCall->args[0]->value;
|
||||
$methodCall->args[0]->value = new String_('#' . preg_quote($oldString->value) . '#');
|
||||
$methodCall->args[0]->value = new String_('#' . preg_quote($oldString->value, '#') . '#');
|
||||
}
|
||||
|
||||
$this->newExpressions[] = $expression;
|
||||
|
@ -18,4 +18,5 @@ parameters:
|
||||
php_version_features: '7.1'
|
||||
|
||||
services:
|
||||
Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector: ~
|
||||
Rector\CodeQuality\Rector\FuncCall\AddPregQuoteDelimiterRector: ~
|
||||
# Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector: ~
|
||||
|
Loading…
x
Reference in New Issue
Block a user