Skip to content

Commit

Permalink
Updated Rector to commit f77cf5af2c486ab2db77c0a88d1c982e76261e09
Browse files Browse the repository at this point in the history
rectorphp/rector-src@f77cf5a [DI] Remove symfony/dependency-injection dependency (#4796)
  • Loading branch information
TomasVotruba committed Aug 15, 2023
1 parent 0648bce commit acc38e2
Show file tree
Hide file tree
Showing 371 changed files with 164 additions and 32,161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use Rector\Core\Configuration\CurrentNodeProvider;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
final class PlainValueParser
{
/**
Expand All @@ -44,9 +43,6 @@ public function __construct(ClassAnnotationMatcher $classAnnotationMatcher, Curr
$this->classAnnotationMatcher = $classAnnotationMatcher;
$this->currentNodeProvider = $currentNodeProvider;
}
/**
* @required
*/
public function autowire(StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser $arrayParser) : void
{
$this->staticDoctrineAnnotationParser = $staticDoctrineAnnotationParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeCommonTypeNarrower;
use Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer;
use Rector\TypeDeclaration\TypeAnalyzer\GenericClassStringTypeNormalizer;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
/**
* @see \Rector\Tests\PHPStanStaticTypeMapper\TypeMapper\ArrayTypeMapperTest
*
Expand Down Expand Up @@ -70,9 +69,6 @@ public function __construct(UnionTypeCommonTypeNarrower $unionTypeCommonTypeNarr
$this->detailedTypeAnalyzer = $detailedTypeAnalyzer;
}
// To avoid circular dependency
/**
* @required
*/
public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void
{
$this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<ConditionalTypeForParameter>
*/
Expand All @@ -21,9 +20,6 @@ final class ConditionalTypeForParameterMapper implements TypeMapperInterface
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
*/
private $phpStanStaticTypeMapper;
/**
* @required
*/
public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void
{
$this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements TypeMapperInterface<ConditionalType>
*/
Expand All @@ -26,7 +25,7 @@ final class ConditionalTypeMapper implements TypeMapperInterface
*/
private $phpStanStaticTypeMapper;
/**
* @required
* @api used in autowire, @todo add to lazy container or remove
*/
public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer;
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeCommonTypeNarrower;
use Rector\PHPStanStaticTypeMapper\ValueObject\UnionTypeAnalysis;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202308\Webmozart\Assert\Assert;
use RectorPrefix202308\Webmozart\Assert\InvalidArgumentException;
/**
Expand Down Expand Up @@ -94,9 +93,6 @@ public function __construct(DoctrineTypeAnalyzer $doctrineTypeAnalyzer, PhpVersi
$this->nodeNameResolver = $nodeNameResolver;
$this->typeFactory = $typeFactory;
}
/**
* @required
*/
public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void
{
$this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use Rector\PhpAttribute\Enum\DocTagNodeState;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202308\Webmozart\Assert\Assert;
/**
* @implements AnnotationToAttributeMapperInterface<mixed[]>
Expand All @@ -33,9 +32,6 @@ public function __construct(ValueResolver $valueResolver)
{
$this->valueResolver = $valueResolver;
}
/**
* @required
*/
public function autowire(AnnotationToAttributeMapper $annotationToAttributeMapper) : void
{
$this->annotationToAttributeMapper = $annotationToAttributeMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use Rector\PhpAttribute\Enum\DocTagNodeState;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202308\Webmozart\Assert\InvalidArgumentException;
/**
* @implements AnnotationToAttributeMapperInterface<ArrayItemNode>
Expand All @@ -27,7 +26,6 @@ final class ArrayItemNodeAnnotationToAttributeMapper implements AnnotationToAttr
private $annotationToAttributeMapper;
/**
* Avoid circular reference
* @required
*/
public function autowire(AnnotationToAttributeMapper $annotationToAttributeMapper) : void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use Rector\PhpAttribute\Enum\DocTagNodeState;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
use RectorPrefix202308\Webmozart\Assert\Assert;
/**
* @implements AnnotationToAttributeMapperInterface<CurlyListNode>
Expand All @@ -23,7 +22,6 @@ final class CurlyListNodeAnnotationToAttributeMapper implements AnnotationToAttr
private $annotationToAttributeMapper;
/**
* Avoid circular reference
* @required
*/
public function autowire(AnnotationToAttributeMapper $annotationToAttributeMapper) : void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Rector\PhpAttribute\AnnotationToAttributeMapper;
use Rector\PhpAttribute\AttributeArrayNameInliner;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements AnnotationToAttributeMapperInterface<DoctrineAnnotationTagValueNode>
*/
Expand All @@ -40,7 +39,6 @@ public function __construct(PhpVersionProvider $phpVersionProvider, AttributeArr
}
/**
* Avoid circular reference
* @required
*/
public function autowire(AnnotationToAttributeMapper $annotationToAttributeMapper) : void
{
Expand Down
4 changes: 0 additions & 4 deletions packages/StaticTypeMapper/Naming/NameScopeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Rector\Naming\Naming\UseImportsResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\StaticTypeMapper\StaticTypeMapper;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
/**
* @see https://github.com/phpstan/phpstan-src/blob/8376548f76e2c845ae047e3010e873015b796818/src/Analyser/NameScope.php#L32
*/
Expand Down Expand Up @@ -55,9 +54,6 @@ public function __construct(UseImportsResolver $useImportsResolver, AstResolver
$this->reflectionResolver = $reflectionResolver;
}
// This is needed to avoid circular references
/**
* @required
*/
public function autowire(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) : void
{
$this->phpDocInfoFactory = $phpDocInfoFactory;
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '7165002817bab1c4d4a17b40fcc6c5cc3d4b2af6';
public const PACKAGE_VERSION = 'f77cf5af2c486ab2db77c0a88d1c982e76261e09';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-16 00:33:31';
public const RELEASE_DATE = '2023-08-16 00:27:13';
/**
* @var int
*/
Expand Down
16 changes: 8 additions & 8 deletions src/Configuration/ConfigInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
use Rector\Core\Php\PhpVersionProvider;
use Rector\PostRector\Contract\Rector\PostRectorInterface;
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix202308\Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
final class ConfigInitializer
{
/**
* @var RectorInterface[]
* @readonly
*/
private $rectors;
/**
* @readonly
* @var \Rector\Core\FileSystem\InitFilePathsResolver
Expand All @@ -29,18 +33,14 @@ final class ConfigInitializer
*/
private $phpVersionProvider;
/**
* @var RectorInterface[]
*/
private $rectors = [];
/**
* @param RewindableGenerator<RectorInterface>|RectorInterface[] $rectors
* @param RectorInterface[] $rectors
*/
public function __construct(iterable $rectors, InitFilePathsResolver $initFilePathsResolver, SymfonyStyle $symfonyStyle, PhpVersionProvider $phpVersionProvider)
public function __construct(array $rectors, InitFilePathsResolver $initFilePathsResolver, SymfonyStyle $symfonyStyle, PhpVersionProvider $phpVersionProvider)
{
$this->rectors = $rectors;
$this->initFilePathsResolver = $initFilePathsResolver;
$this->symfonyStyle = $symfonyStyle;
$this->phpVersionProvider = $phpVersionProvider;
$this->rectors = $rectors instanceof RewindableGenerator ? \iterator_to_array($rectors->getIterator()) : $rectors;
}
public function createConfig(string $projectDirectory) : void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Parameter/SimpleParameterProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Rector\Core\Configuration\Parameter;

use Rector\Core\Configuration\Option;
use RectorPrefix202308\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Rector\Core\Exception\ShouldNotHappenException;
use RectorPrefix202308\Webmozart\Assert\Assert;
/**
* @api
Expand Down Expand Up @@ -115,6 +115,6 @@ private static function ensureParameterIsSet(string $name) : void
if (\array_key_exists($name, self::$parameters)) {
return;
}
throw new ParameterNotFoundException($name);
throw new ShouldNotHappenException(\sprintf('Parameter "%s" was not found', $name));
}
}
13 changes: 5 additions & 8 deletions src/Console/Command/ListRulesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use RectorPrefix202308\Symfony\Component\Console\Input\InputOption;
use RectorPrefix202308\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202308\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix202308\Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
final class ListRulesCommand extends Command
{
/**
Expand All @@ -29,20 +28,18 @@ final class ListRulesCommand extends Command
private $skippedClassResolver;
/**
* @var RectorInterface[]
* @readonly
*/
private $rectors = [];
private $rectors;
/**
* @param RewindableGenerator<RectorInterface>|RectorInterface[] $rectors
* @param RectorInterface[] $rectors
*/
public function __construct(SymfonyStyle $symfonyStyle, SkippedClassResolver $skippedClassResolver, iterable $rectors)
public function __construct(SymfonyStyle $symfonyStyle, SkippedClassResolver $skippedClassResolver, array $rectors)
{
$this->symfonyStyle = $symfonyStyle;
$this->skippedClassResolver = $skippedClassResolver;
parent::__construct();
if ($rectors instanceof RewindableGenerator) {
$rectors = \iterator_to_array($rectors->getIterator());
}
$this->rectors = $rectors;
parent::__construct();
}
protected function configure() : void
{
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions src/DependencyInjection/RectorContainerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
declare (strict_types=1);
namespace Rector\Core\DependencyInjection;

use RectorPrefix202308\Psr\Container\ContainerInterface;
use RectorPrefix202308\Illuminate\Container\Container;
use Rector\Caching\Detector\ChangedFilesDetector;
use Rector\Core\Autoloading\BootstrapFilesIncluder;
use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs;
final class RectorContainerFactory
{
public function createFromBootstrapConfigs(BootstrapConfigs $bootstrapConfigs) : ContainerInterface
public function createFromBootstrapConfigs(BootstrapConfigs $bootstrapConfigs) : Container
{
$container = $this->createFromConfigs($bootstrapConfigs->getConfigFiles());
$mainConfigFile = $bootstrapConfigs->getMainConfigFile();
if ($mainConfigFile !== null) {
/** @var ChangedFilesDetector $changedFilesDetector */
$changedFilesDetector = $container->get(ChangedFilesDetector::class);
$changedFilesDetector = $container->make(ChangedFilesDetector::class);
$changedFilesDetector->setFirstResolvedConfigFileInfo($mainConfigFile);
}
/** @var BootstrapFilesIncluder $bootstrapFilesIncluder */
Expand All @@ -26,7 +26,7 @@ public function createFromBootstrapConfigs(BootstrapConfigs $bootstrapConfigs) :
/**
* @param string[] $configFiles
*/
private function createFromConfigs(array $configFiles) : ContainerInterface
private function createFromConfigs(array $configFiles) : Container
{
$lazyContainerFactory = new \Rector\Core\DependencyInjection\LazyContainerFactory();
$container = $lazyContainerFactory->create();
Expand Down
15 changes: 7 additions & 8 deletions src/PhpParser/NodeTraverser/RectorNodeTraverser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
use PhpParser\NodeTraverser;
use Rector\Core\Contract\Rector\PhpRectorInterface;
use Rector\VersionBonding\PhpVersionedFilter;
use RectorPrefix202308\Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
final class RectorNodeTraverser extends NodeTraverser
{
/**
* @var PhpRectorInterface[]
*/
private $phpRectors;
/**
* @readonly
* @var \Rector\VersionBonding\PhpVersionedFilter
Expand All @@ -20,16 +23,12 @@ final class RectorNodeTraverser extends NodeTraverser
*/
private $areNodeVisitorsPrepared = \false;
/**
* @var PhpRectorInterface[]
*/
private $phpRectors = [];
/**
* @param RewindableGenerator<PhpRectorInterface>|PhpRectorInterface[] $phpRectors
* @param PhpRectorInterface[] $phpRectors
*/
public function __construct(iterable $phpRectors, PhpVersionedFilter $phpVersionedFilter)
public function __construct(array $phpRectors, PhpVersionedFilter $phpVersionedFilter)
{
$this->phpRectors = $phpRectors;
$this->phpVersionedFilter = $phpVersionedFilter;
$this->phpRectors = \is_array($phpRectors) ? $phpRectors : \iterator_to_array($phpRectors);
parent::__construct();
}
/**
Expand Down

0 comments on commit acc38e2

Please sign in to comment.