Updated Rector to commit a82c86347a6ceba31cdf3180284dc96820e50271

a82c86347a [DX] Make use of Laravel container in few tests - step #2 (#4678)
This commit is contained in:
Tomas Votruba 2023-08-06 16:40:08 +00:00
parent c122d338d1
commit 38829f40f1
7 changed files with 51 additions and 19 deletions

View File

@ -23,11 +23,15 @@ final class AnnotationToAttributeMapper
*/
private $annotationToAttributeMappers = [];
/**
* @param RewindableGenerator<AnnotationToAttributeMapperInterface> $annotationToAttributeMappers
* @param RewindableGenerator<AnnotationToAttributeMapperInterface>|AnnotationToAttributeMapperInterface[] $annotationToAttributeMappers
*/
public function __construct(iterable $annotationToAttributeMappers)
{
$this->annotationToAttributeMappers = \iterator_to_array($annotationToAttributeMappers->getIterator());
if ($annotationToAttributeMappers instanceof RewindableGenerator) {
$this->annotationToAttributeMappers = \iterator_to_array($annotationToAttributeMappers->getIterator());
} else {
$this->annotationToAttributeMappers = $annotationToAttributeMappers;
}
}
/**
* @return Expr|DocTagNodeState::REMOVE_ARRAY

View File

@ -34,7 +34,6 @@ final class ArrayAnnotationToAttributeMapper implements AnnotationToAttributeMap
$this->valueResolver = $valueResolver;
}
/**
* Avoid circular reference
* @required
*/
public function autowire(AnnotationToAttributeMapper $annotationToAttributeMapper) : void

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '56195b368e89f7fc7d92fe96703286f9c4985f18';
public const PACKAGE_VERSION = 'a82c86347a6ceba31cdf3180284dc96820e50271';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-06 16:44:19';
public const RELEASE_DATE = '2023-08-06 17:36:42';
/**
* @var int
*/

View File

@ -35,6 +35,16 @@ use Rector\NodeNameResolver\NodeNameResolver\VariableNameResolver;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\ArrayAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\ArrayItemNodeAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\ClassConstFetchAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\ConstExprNodeAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\CurlyListNodeAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\DoctrineAnnotationAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\StringAnnotationToAttributeMapper;
use Rector\PhpAttribute\AnnotationToAttributeMapper\StringNodeAnnotationToAttributeMapper;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface;
@ -48,6 +58,10 @@ final class LazyContainerFactory
* @var array<class-string<NodeNameResolverInterface>>
*/
private const NODE_NAME_RESOLVER_CLASSES = [ClassConstFetchNameResolver::class, ClassConstNameResolver::class, ClassNameResolver::class, EmptyNameResolver::class, FuncCallNameResolver::class, FunctionNameResolver::class, NameNameResolver::class, ParamNameResolver::class, PropertyNameResolver::class, UseNameResolver::class, VariableNameResolver::class];
/**
* @var array<class-string<AnnotationToAttributeMapperInterface>>
*/
private const ANNOTATION_TO_ATTRIBUTE_MAPPER_CLASSES = [ArrayAnnotationToAttributeMapper::class, ArrayItemNodeAnnotationToAttributeMapper::class, ClassConstFetchAnnotationToAttributeMapper::class, ConstExprNodeAnnotationToAttributeMapper::class, CurlyListNodeAnnotationToAttributeMapper::class, DoctrineAnnotationAnnotationToAttributeMapper::class, StringAnnotationToAttributeMapper::class, StringNodeAnnotationToAttributeMapper::class];
/**
* @api used as next container factory
*/
@ -86,10 +100,14 @@ final class LazyContainerFactory
$container->when(NodeTypeResolver::class)->needs('$nodeTypeResolvers')->giveTagged(NodeTypeResolverInterface::class);
// node name resolvers
$container->when(NodeNameResolver::class)->needs('$nodeNameResolvers')->giveTagged(NodeNameResolverInterface::class);
foreach (self::NODE_NAME_RESOLVER_CLASSES as $nodeNameResolverClass) {
$container->singleton($nodeNameResolverClass);
$container->tag($nodeNameResolverClass, NodeNameResolverInterface::class);
}
$this->registerTagged($container, self::NODE_NAME_RESOLVER_CLASSES, NodeNameResolverInterface::class);
$container->when(AnnotationToAttributeMapper::class)->needs('$annotationToAttributeMappers')->giveTagged(AnnotationToAttributeMapperInterface::class);
$this->registerTagged($container, self::ANNOTATION_TO_ATTRIBUTE_MAPPER_CLASSES, AnnotationToAttributeMapperInterface::class);
// #[Required]-like setter
$container->afterResolving(ArrayAnnotationToAttributeMapper::class, static function (ArrayAnnotationToAttributeMapper $arrayAnnotationToAttributeMapper, Container $container) : void {
$annotationToAttributesMapper = $container->make(AnnotationToAttributeMapper::class);
$arrayAnnotationToAttributeMapper->autowire($annotationToAttributesMapper);
});
$container->singleton(Parser::class, static function (Container $container) {
$phpstanServiceFactory = $container->make(PHPStanServicesFactory::class);
return $phpstanServiceFactory->createPHPStanParser();
@ -116,4 +134,15 @@ final class LazyContainerFactory
$container->when(PhpDocNodeMapper::class)->needs('$phpDocNodeVisitors')->giveTagged(BasePhpDocNodeVisitorInterface::class);
return $container;
}
/**
* @param array<class-string> $classes
* @param class-string $tagInterface
*/
private function registerTagged(Container $container, array $classes, string $tagInterface) : void
{
foreach ($classes as $class) {
$container->singleton($class);
$container->tag($class, $tagInterface);
}
}
}

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit7809b9532ad085be2a1d5bb6195fd85a
class ComposerAutoloaderInit44aea186af25479658e98a5f55cf935c
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit7809b9532ad085be2a1d5bb6195fd85a
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit7809b9532ad085be2a1d5bb6195fd85a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit44aea186af25479658e98a5f55cf935c', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit7809b9532ad085be2a1d5bb6195fd85a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit44aea186af25479658e98a5f55cf935c', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit44aea186af25479658e98a5f55cf935c::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit44aea186af25479658e98a5f55cf935c::$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 ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a
class ComposerStaticInit44aea186af25479658e98a5f55cf935c
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3011,9 +3011,9 @@ class ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7809b9532ad085be2a1d5bb6195fd85a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit44aea186af25479658e98a5f55cf935c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit44aea186af25479658e98a5f55cf935c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit44aea186af25479658e98a5f55cf935c::$classMap;
}, null, ClassLoader::class);
}