Updated Rector to commit f733c32f6c44c06faeba9ad5c46a62b8eee11748

f733c32f6c [Transform] Refactor AddAllowDynamicPropertiesAttributeRector with verify both fnmatch and is string name (#4993)
This commit is contained in:
Tomas Votruba 2023-09-11 15:00:52 +00:00
parent 67ef720476
commit 02ce33183a
5 changed files with 46 additions and 25 deletions

View File

@ -129,25 +129,46 @@ CODE_SAMPLE
}
private function shouldSkip(Class_ $class) : bool
{
$className = (string) $this->nodeNameResolver->getName($class);
foreach ($this->transformOnNamespaces as $transformOnNamespace) {
if (\strpos($transformOnNamespace, '*') !== \false) {
if (!\fnmatch($transformOnNamespace, $className, \FNM_NOESCAPE)) {
return \true;
}
continue;
}
if ($this->nodeNameResolver->isStringName($className, $transformOnNamespace)) {
continue;
}
}
if ($this->isDescendantOfStdclass($class)) {
return \true;
}
if ($this->hasNeededAttributeAlready($class)) {
return \true;
}
return $this->hasMagicSetMethod($class);
if ($this->hasMagicSetMethod($class)) {
return \true;
}
$className = (string) $this->getName($class);
if ($this->transformOnNamespaces !== []) {
return !$this->isExistsWithWildCards($className) && !$this->isExistsWithClassName($className);
}
return \false;
}
private function isExistsWithWildCards(string $className) : bool
{
$wildcardTransformOnNamespaces = \array_filter($this->transformOnNamespaces, static function (string $transformOnNamespace) : bool {
return \strpos($transformOnNamespace, '*') !== \false;
});
foreach ($wildcardTransformOnNamespaces as $wildcardTransformOnNamespace) {
if (!\fnmatch($wildcardTransformOnNamespace, $className, \FNM_NOESCAPE)) {
continue;
}
return \true;
}
return \false;
}
private function isExistsWithClassName(string $className) : bool
{
$transformedClassNames = \array_filter($this->transformOnNamespaces, static function (string $transformOnNamespace) : bool {
return \strpos($transformOnNamespace, '*') === \false;
});
foreach ($transformedClassNames as $transformedClassName) {
if (!$this->nodeNameResolver->isStringName($className, $transformedClassName)) {
continue;
}
return \true;
}
return \false;
}
private function hasMagicSetMethod(Class_ $class) : bool
{

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '780ef4010d45be3e89844dec073ce2078a10f96f';
public const PACKAGE_VERSION = 'f733c32f6c44c06faeba9ad5c46a62b8eee11748';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-09-11 16:51:56';
public const RELEASE_DATE = '2023-09-11 21:58:13';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit1a59d7cab7aa0d09a0e37da08afa7e9b::getLoader();
return ComposerAutoloaderInit1003eb6ec3bf1c99d92643e59f44f5a6::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit1a59d7cab7aa0d09a0e37da08afa7e9b
class ComposerAutoloaderInit1003eb6ec3bf1c99d92643e59f44f5a6
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit1a59d7cab7aa0d09a0e37da08afa7e9b
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit1a59d7cab7aa0d09a0e37da08afa7e9b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1003eb6ec3bf1c99d92643e59f44f5a6', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit1a59d7cab7aa0d09a0e37da08afa7e9b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1003eb6ec3bf1c99d92643e59f44f5a6', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit1003eb6ec3bf1c99d92643e59f44f5a6::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit1003eb6ec3bf1c99d92643e59f44f5a6::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b
class ComposerStaticInit1003eb6ec3bf1c99d92643e59f44f5a6
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2595,9 +2595,9 @@ class ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1a59d7cab7aa0d09a0e37da08afa7e9b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit1003eb6ec3bf1c99d92643e59f44f5a6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1003eb6ec3bf1c99d92643e59f44f5a6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1003eb6ec3bf1c99d92643e59f44f5a6::$classMap;
}, null, ClassLoader::class);
}