rector/rules/Autodiscovery/FileLocation/ExpectedFileLocationResolver.php
Tomas Votruba d56e7982d0 Updated Rector to commit dedd4b55fe3e03cae9bd5ac822cfdccd8deb3fb6
dedd4b55fe make node_helper.php safe for similar names
2021-05-09 20:15:43 +00:00

18 lines
540 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Autodiscovery\FileLocation;
final class ExpectedFileLocationResolver
{
/**
* Resolves if is suffix in the same category, e.g. "Exception/SomeException.php"
*/
public function resolve(string $escapedGroupName, string $suffixPattern) : string
{
$escapedGroupName = \preg_quote($escapedGroupName, '#');
$escapedSuffixPattern = \preg_quote($suffixPattern, '#');
return \sprintf('#\\/%s\\/.+%s#', $escapedGroupName, $escapedSuffixPattern);
}
}