mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 13:38:44 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -22,11 +22,11 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
*/
|
||||
class PassConfig
|
||||
{
|
||||
const TYPE_AFTER_REMOVING = 'afterRemoving';
|
||||
const TYPE_BEFORE_OPTIMIZATION = 'beforeOptimization';
|
||||
const TYPE_BEFORE_REMOVING = 'beforeRemoving';
|
||||
const TYPE_OPTIMIZE = 'optimization';
|
||||
const TYPE_REMOVE = 'removing';
|
||||
public const TYPE_AFTER_REMOVING = 'afterRemoving';
|
||||
public const TYPE_BEFORE_OPTIMIZATION = 'beforeOptimization';
|
||||
public const TYPE_BEFORE_REMOVING = 'beforeRemoving';
|
||||
public const TYPE_OPTIMIZE = 'optimization';
|
||||
public const TYPE_REMOVE = 'removing';
|
||||
|
||||
private $mergePass;
|
||||
private $afterRemovingPasses = [];
|
||||
@@ -41,7 +41,9 @@ class PassConfig
|
||||
|
||||
$this->beforeOptimizationPasses = [
|
||||
100 => [
|
||||
$resolveClassPass = new ResolveClassPass(),
|
||||
new ResolveClassPass(),
|
||||
new RegisterAutoconfigureAttributesPass(),
|
||||
new AttributeAutoconfigurationPass(),
|
||||
new ResolveInstanceofConditionalsPass(),
|
||||
new RegisterEnvVarProcessorsPass(),
|
||||
],
|
||||
@@ -49,18 +51,22 @@ class PassConfig
|
||||
];
|
||||
|
||||
$this->optimizationPasses = [[
|
||||
$autoAliasServicePass = new AutoAliasServicePass(),
|
||||
new ValidateEnvPlaceholdersPass(),
|
||||
new ResolveDecoratorStackPass(),
|
||||
new ResolveChildDefinitionsPass(),
|
||||
new ServiceLocatorTagPass(),
|
||||
new RegisterServiceSubscribersPass(),
|
||||
new DecoratorServicePass(),
|
||||
new ResolveParameterPlaceHoldersPass(false, false),
|
||||
new ResolveFactoryClassPass(),
|
||||
new FactoryReturnTypePass($resolveClassPass),
|
||||
new CheckDefinitionValidityPass(),
|
||||
new ResolveNamedArgumentsPass(),
|
||||
new AutowireRequiredMethodsPass(),
|
||||
new AutowireRequiredPropertiesPass(),
|
||||
new ResolveBindingsPass(),
|
||||
new ServiceLocatorTagPass(),
|
||||
new DecoratorServicePass(),
|
||||
new CheckDefinitionValidityPass(),
|
||||
new AutowirePass(false),
|
||||
new ServiceLocatorTagPass(),
|
||||
new ResolveTaggedIteratorArgumentPass(),
|
||||
new ResolveServiceSubscribersPass(),
|
||||
new ResolveReferencesToAliasesPass(),
|
||||
@@ -71,25 +77,22 @@ class PassConfig
|
||||
new CheckArgumentsValidityPass(false),
|
||||
]];
|
||||
|
||||
$this->beforeRemovingPasses = [
|
||||
-100 => [
|
||||
new ResolvePrivatesPass(),
|
||||
],
|
||||
];
|
||||
|
||||
$this->removingPasses = [[
|
||||
new RemovePrivateAliasesPass(),
|
||||
new ReplaceAliasByActualDefinitionPass(),
|
||||
(new ReplaceAliasByActualDefinitionPass())->setAutoAliasServicePass($autoAliasServicePass),
|
||||
new RemoveAbstractDefinitionsPass(),
|
||||
new RepeatedPass([
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new InlineServiceDefinitionsPass(),
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new RemoveUnusedDefinitionsPass(),
|
||||
]),
|
||||
new DefinitionErrorExceptionPass(),
|
||||
new RemoveUnusedDefinitionsPass(),
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new CheckExceptionOnInvalidReferenceBehaviorPass(),
|
||||
new InlineServiceDefinitionsPass(new AnalyzeServiceReferencesPass()),
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new DefinitionErrorExceptionPass(),
|
||||
]];
|
||||
|
||||
$this->afterRemovingPasses = [[
|
||||
new ResolveHotPathPass(),
|
||||
new ResolveNoPreloadPass(),
|
||||
new AliasDeprecatedPublicServicesPass(),
|
||||
]];
|
||||
}
|
||||
|
||||
@@ -113,26 +116,10 @@ class PassConfig
|
||||
/**
|
||||
* Adds a pass.
|
||||
*
|
||||
* @param CompilerPassInterface $pass A Compiler pass
|
||||
* @param string $type The pass type
|
||||
*
|
||||
* @throws InvalidArgumentException when a pass type doesn't exist
|
||||
*/
|
||||
public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/)
|
||||
public function addPass(CompilerPassInterface $pass, string $type = self::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
|
||||
{
|
||||
if (\func_num_args() >= 3) {
|
||||
$priority = func_get_arg(2);
|
||||
} else {
|
||||
if (__CLASS__ !== static::class) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
||||
@trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$priority = 0;
|
||||
}
|
||||
|
||||
$property = $type.'Passes';
|
||||
if (!isset($this->$property)) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type));
|
||||
@@ -268,7 +255,7 @@ class PassConfig
|
||||
*
|
||||
* @return CompilerPassInterface[]
|
||||
*/
|
||||
private function sortPasses(array $passes)
|
||||
private function sortPasses(array $passes): array
|
||||
{
|
||||
if (0 === \count($passes)) {
|
||||
return [];
|
||||
@@ -277,6 +264,6 @@ class PassConfig
|
||||
krsort($passes);
|
||||
|
||||
// Flatten the array
|
||||
return \call_user_func_array('array_merge', $passes);
|
||||
return array_merge(...$passes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user