New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PackageBuilder] Add AutowireArrayParameterCompilerPass #1145

Merged
merged 9 commits into from Oct 6, 2018
@@ -5,7 +5,7 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\ConfigurableCollectorCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\PublicForTestsCompilerPass;
use Symplify\PackageBuilder\HttpKernel\SimpleKernelTrait;
@@ -21,6 +21,6 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new PublicForTestsCompilerPass());
$containerBuilder->addCompilerPass(new ConfigurableCollectorCompilerPass());
$containerBuilder->addCompilerPass(new AutowireArrayParameterCompilerPass());
}
}
@@ -36,21 +36,21 @@ final class PhpDocInfoFactory
*/
private $typeNodeToStringsConvertor;
/**
* @param PhpDocInfoDecoratorInterface[] $phpDocInfoDecorators
*/
public function __construct(
PhpDocParser $phpDocParser,
Lexer $lexer,
PhpDocModifier $phpDocModifier,
TypeNodeToStringsConvertor $typeNodeToStringsConvertor
TypeNodeToStringsConvertor $typeNodeToStringsConvertor,
array $phpDocInfoDecorators = []
) {
$this->phpDocParser = $phpDocParser;
$this->lexer = $lexer;
$this->phpDocModifier = $phpDocModifier;
$this->typeNodeToStringsConvertor = $typeNodeToStringsConvertor;
}
public function addPhpDocInfoDecorator(PhpDocInfoDecoratorInterface $phpDocInfoDecorator): void
{
$this->phpDocInfoDecorators[] = $phpDocInfoDecorator;
$this->phpDocInfoDecorators = $phpDocInfoDecorators;
}
public function createFrom(string $content): PhpDocInfo
@@ -1,9 +1,2 @@
imports:
- { resource: 'services.yml' }

parameters:
collectors:
-
main_type: 'Symplify\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory'
collected_type: 'Symplify\BetterPhpDocParser\Contract\PhpDocInfoDecoratorInterface'
add_method: 'addPhpDocInfoDecorator'
@@ -29,19 +29,19 @@ final class ChangelogLinker
*/
private $versionsAnalyzer;
/**
* @param WorkerInterface[] $workers
*/
public function __construct(
LinksAnalyzer $linksAnalyzer,
LinkAppender $linkAppender,
VersionsAnalyzer $versionsAnalyzer
VersionsAnalyzer $versionsAnalyzer,
array $workers = []
) {
$this->linksAnalyzer = $linksAnalyzer;
$this->linkAppender = $linkAppender;
$this->versionsAnalyzer = $versionsAnalyzer;
}
public function addWorker(WorkerInterface $worker): void
{
$this->workers[] = $worker;
$this->workers = $workers;
}
public function processContent(string $content): string
@@ -7,6 +7,7 @@
use Symfony\Component\HttpKernel\Kernel;
use Symplify\ChangelogLinker\DependencyInjection\CompilerPass\DetectParametersCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutoBindParametersCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\ConfigurableCollectorCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\PublicForTestsCompilerPass;
use Symplify\PackageBuilder\HttpKernel\SimpleKernelTrait;
@@ -49,6 +50,7 @@ public function bootWithConfig(string $config): void
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new PublicForTestsCompilerPass());
$containerBuilder->addCompilerPass(new AutowireArrayParameterCompilerPass());
$containerBuilder->addCompilerPass(new ConfigurableCollectorCompilerPass());
$containerBuilder->addCompilerPass(new DetectParametersCompilerPass());
$containerBuilder->addCompilerPass(new AutoBindParametersCompilerPass());
@@ -11,9 +11,3 @@ parameters:
# use in cli like: "GITHUB_TOKEN=%s vendor/bin/changelog-linker dump-merges ..."
env(GITHUB_TOKEN): null
github_token: '%env(GITHUB_TOKEN)%'

collectors:
-
main_type: 'Symplify\ChangelogLinker\ChangelogLinker'
collected_type: 'Symplify\ChangelogLinker\Contract\Worker\WorkerInterface'
add_method: 'addWorker'
@@ -67,14 +67,18 @@ final class FixerFileProcessor implements FileProcessorInterface
*/
private $currentFileProvider;
/**
* @param FixerInterface[] $fixers
*/
public function __construct(
ErrorAndDiffCollector $errorAndDiffCollector,
Configuration $configuration,
FileToTokensParser $fileToTokensParser,
CachedFileLoader $cachedFileLoader,
Skipper $skipper,
DifferInterface $differ,
CurrentFileProvider $currentFileProvider
CurrentFileProvider $currentFileProvider,
array $fixers = []
) {
$this->errorAndDiffCollector = $errorAndDiffCollector;
$this->skipper = $skipper;
@@ -83,11 +87,7 @@ public function __construct(
$this->cachedFileLoader = $cachedFileLoader;
$this->differ = $differ;
$this->currentFileProvider = $currentFileProvider;
}
public function addFixer(FixerInterface $fixer): void
{
$this->fixers[] = $fixer;
$this->fixers = $fixers;
}
/**
@@ -83,6 +83,9 @@ final class SniffFileProcessor implements FileProcessorInterface, DualRunAwareFi
*/
private $currentFileProvider;
/**
* @param Sniff[] $sniffs
*/
public function __construct(
Fixer $fixer,
FileFactory $fileFactory,
@@ -92,7 +95,8 @@ public function __construct(
ErrorAndDiffCollector $errorAndDiffCollector,
DifferInterface $differ,
AppliedCheckersCollector $appliedCheckersCollector,
CurrentFileProvider $currentFileProvider
CurrentFileProvider $currentFileProvider,
array $sniffs = []
) {
$this->fixer = $fixer;
$this->fileFactory = $fileFactory;
@@ -105,6 +109,10 @@ public function __construct(
$this->currentFileProvider = $currentFileProvider;
$this->addCompatibilityLayer();
foreach ($sniffs as $sniff) {
$this->addSniff($sniff);
}
}
public function addSniff(Sniff $sniff): void
@@ -18,6 +18,7 @@
use Symplify\EasyCodingStandard\DependencyInjection\CompilerPass\RemoveExcludedCheckersCompilerPass;
use Symplify\EasyCodingStandard\DependencyInjection\CompilerPass\RemoveMutualCheckersCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutoBindParametersCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireInterfacesCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireSinglyImplementedCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\ConfigurableCollectorCompilerPass;
@@ -82,6 +83,7 @@ protected function build(ContainerBuilder $containerBuilder): void
FixerInterface::class,
Sniff::class,
]));
$containerBuilder->addCompilerPass(new AutowireArrayParameterCompilerPass());
// exceptions
$containerBuilder->addCompilerPass(new ConflictingCheckersCompilerPass());
@@ -14,13 +14,3 @@ parameters:
root_skip: []
# for tests
env(TEST_SUFFIX): ''

collectors:
-
main_type: 'Symplify\EasyCodingStandard\SniffRunner\Application\SniffFileProcessor'
collected_type: 'PHP_CodeSniffer\Sniffs\Sniff'
add_method: 'addSniff'
-
main_type: 'Symplify\EasyCodingStandard\FixerRunner\Application\FixerFileProcessor'
collected_type: 'PhpCsFixer\Fixer\FixerInterface'
add_method: 'addFixer'
@@ -5,7 +5,7 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\ConfigurableCollectorCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireArrayParameterCompilerPass;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\PublicForTestsCompilerPass;
use Symplify\PackageBuilder\HttpKernel\SimpleKernelTrait;
@@ -23,7 +23,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
*/
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new ConfigurableCollectorCompilerPass());
$containerBuilder->addCompilerPass(new AutowireArrayParameterCompilerPass());
$containerBuilder->addCompilerPass(new PublicForTestsCompilerPass());
}
}
@@ -13,9 +13,12 @@ final class LatteToTwigConverter
*/
private $caseConverters = [];
public function addCaseConverter(CaseConverterInterface $caseConverter): void
/**
* @param CaseConverterInterface[] $caseConverters
*/
public function __construct(array $caseConverters = [])
{
$this->caseConverters[] = $caseConverter;
$this->caseConverters = $caseConverters;
}
public function convertFile(string $file): string
@@ -1,9 +1,2 @@
imports:
- { resource: 'services.yml' }

parameters:
collectors:
-
main_type: 'Symplify\LatteToTwigConverter\LatteToTwigConverter'
collected_type: 'Symplify\LatteToTwigConverter\Contract\CaseConverter\CaseConverterInterface'
add_method: 'addCaseConverter'
@@ -30,20 +30,18 @@ final class DependenciesMerger
/**
* @param string[] $mergeSections
* @param ComposerJsonDecoratorInterface[] $composerJsonDecorators
*/
public function __construct(
array $mergeSections,
JsonFileManager $jsonFileManager,
MergedPackagesCollector $mergedPackagesCollector
MergedPackagesCollector $mergedPackagesCollector,
array $composerJsonDecorators = []
) {
$this->mergeSections = $mergeSections;
$this->jsonFileManager = $jsonFileManager;
$this->mergedPackagesCollector = $mergedPackagesCollector;
}
public function addComposerJsonDecorator(ComposerJsonDecoratorInterface $composerJsonDecorator): void
{
$this->composerJsonDecorators[] = $composerJsonDecorator;
$this->composerJsonDecorators = $composerJsonDecorators;
}
/**
@@ -33,9 +33,3 @@ parameters:
- 'minimum-stability'
- 'prefer-stable'
- 'extra'

collectors:
-
main_type: 'Symplify\MonorepoBuilder\DependenciesMerger'
collected_type: 'Symplify\MonorepoBuilder\Contract\ComposerJsonDecoratorInterface'
add_method: 'addComposerJsonDecorator'
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.