diff --git a/.travis.yml b/.travis.yml index 1e38463c1e..2876e328be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -149,7 +149,7 @@ before_install: if [[ $PHP = 8.* ]]; then tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI else - tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI + tfold ext.mongodb tpecl mongodb-1.8.1 mongodb.so $INI tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI fi @@ -215,13 +215,6 @@ install: export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort) fi - - | - # Set composer's platform to php 7.4 if we're on php 8. - if [[ $PHP = 8.* ]]; then - composer config platform.php 7.4.99 - export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 - fi - - | # Install symfony/flex if [[ $deps = low ]]; then @@ -262,7 +255,7 @@ install: fi phpenv global $PHP rm vendor/composer/package-versions-deprecated -Rf - ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.6.99; composer require --dev --no-update mongodb/mongodb ~1.5.0) + ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.8.99; composer require --dev --no-update mongodb/mongodb ^1.8.1) tfold 'composer update' $COMPOSER_UP tfold 'phpunit install' ./phpunit install if [[ $deps = high ]]; then @@ -279,7 +272,7 @@ install: git fetch --depth=2 origin $SYMFONY_VERSION git checkout -m FETCH_HEAD COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort) - (cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.99; composer require --dev --no-update mongodb/mongodb) + (cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.8.99; composer require --dev --no-update mongodb/mongodb) [[ ! $COMPONENTS ]] || tfold 'phpunit install' SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 ./phpunit install [[ ! $COMPONENTS ]] || echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1 fi diff --git a/composer.json b/composer.json index f216ac6ef9..3b23c02c31 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "require": { "php": ">=7.2.5", "ext-xml": "*", + "friendsofphp/proxy-manager-lts": "^1.0", "doctrine/event-manager": "~1.0", "doctrine/persistence": "^2", "twig/twig": "^2.10|^3.0", @@ -122,7 +123,6 @@ "masterminds/html5": "^2.6", "monolog/monolog": "^1.25.1|^2", "nyholm/psr7": "^1.0", - "ocramius/proxy-manager": "^2.1", "paragonie/sodium_compat": "^1.8", "pda/pheanstalk": "^4.0", "php-http/httplug": "^1.0|^2.0", diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php index d3c93d1956..d01148f3b0 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php @@ -18,6 +18,8 @@ class StringWrapperType extends StringType { /** * {@inheritdoc} + * + * @return mixed */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { @@ -26,6 +28,8 @@ class StringWrapperType extends StringType /** * {@inheritdoc} + * + * @return mixed */ public function convertToPHPValue($value, AbstractPlatform $platform) { diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php index 1131666483..7c09108fde 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php @@ -43,6 +43,8 @@ class DoctrineFooType extends Type /** * {@inheritdoc} + * + * @return mixed */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { @@ -58,6 +60,8 @@ class DoctrineFooType extends Type /** * {@inheritdoc} + * + * @return mixed */ public function convertToPHPValue($value, AbstractPlatform $platform) { diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php index be4838a795..502c36fb88 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php @@ -83,6 +83,8 @@ class ConsoleFormatter implements FormatterInterface /** * {@inheritdoc} + * + * @return mixed */ public function formatBatch(array $records) { @@ -95,6 +97,8 @@ class ConsoleFormatter implements FormatterInterface /** * {@inheritdoc} + * + * @return mixed */ public function format(array $record) { diff --git a/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php index e96b510a8b..8fe52385cc 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php @@ -26,6 +26,11 @@ class VarDumperFormatter implements FormatterInterface $this->cloner = $cloner ?: new VarCloner(); } + /** + * {@inheritdoc} + * + * @return mixed + */ public function format(array $record) { $record['context'] = $this->cloner->cloneVar($record['context']); @@ -34,6 +39,11 @@ class VarDumperFormatter implements FormatterInterface return $record; } + /** + * {@inheritdoc} + * + * @return mixed + */ public function formatBatch(array $records) { foreach ($records as $k => $record) { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php index eee54e5ca2..75fa047741 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php @@ -48,7 +48,11 @@ class RuntimeInstantiator implements InstantiatorInterface $proxy->setProxyInitializer(null); return true; - } + }, + [ + 'fluentSafe' => $definition->hasTag('proxy'), + 'skipDestructor' => true, + ] ); } } diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php index 2ff31bbda3..2ce78cd523 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php @@ -11,87 +11,26 @@ namespace Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper; +use Laminas\Code\Generator\ClassGenerator; use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator as BaseGenerator; use Symfony\Component\DependencyInjection\Definition; -use Zend\Code\Generator\ClassGenerator; /** * @internal */ class LazyLoadingValueHolderGenerator extends BaseGenerator { - private $fluentSafe = false; - - public function setFluentSafe(bool $fluentSafe) - { - $this->fluentSafe = $fluentSafe; - } - /** * {@inheritdoc} */ - public function generate(\ReflectionClass $originalClass, ClassGenerator $classGenerator): void + public function generate(\ReflectionClass $originalClass, ClassGenerator $classGenerator, array $proxyOptions = []): void { - parent::generate($originalClass, $classGenerator); + parent::generate($originalClass, $classGenerator, $proxyOptions); foreach ($classGenerator->getMethods() as $method) { - $body = preg_replace( - '/(\$this->initializer[0-9a-f]++) && \1->__invoke\(\$this->(valueHolder[0-9a-f]++), (.*?), \1\);/', - '$1 && ($1->__invoke(\$$2, $3, $1) || 1) && $this->$2 = \$$2;', - $method->getBody() - ); - $body = str_replace('(new \ReflectionClass(get_class()))', '$reflection', $body); - $body = str_replace('$reflection = $reflection ?: ', '$reflection = $reflection ?? ', $body); - $body = str_replace('$reflection ?? $reflection = ', '$reflection ?? ', $body); - - if ($originalClass->isInterface()) { - $body = str_replace('get_parent_class($this)', var_export($originalClass->name, true), $body); - $body = preg_replace_callback('/\n\n\$realInstanceReflection = [^{]++\{([^}]++)\}\n\n.*/s', function ($m) { - $r = ''; - foreach (explode("\n", $m[1]) as $line) { - $r .= "\n".substr($line, 4); - if (0 === strpos($line, ' return ')) { - break; - } - } - - return $r; - }, $body); - } - - if ($this->fluentSafe) { - $indent = $method->getIndentation(); - $method->setIndentation(''); - $code = $method->generate(); - if (null !== $docBlock = $method->getDocBlock()) { - $code = substr($code, \strlen($docBlock->generate())); - } - $refAmp = (strpos($code, '&') ?: \PHP_INT_MAX) <= strpos($code, '(') ? '&' : ''; - $body = preg_replace( - '/\nreturn (\$this->valueHolder[0-9a-f]++)(->[^;]++);$/', - "\nif ($1 === \$returnValue = {$refAmp}$1$2) {\n \$returnValue = \$this;\n}\n\nreturn \$returnValue;", - $body - ); - $method->setIndentation($indent); - } - if (0 === strpos($originalClass->getFilename(), __FILE__)) { - $body = str_replace(var_export($originalClass->name, true), '__CLASS__', $body); + $method->setBody(str_replace(var_export($originalClass->name, true), '__CLASS__', $method->getBody())); } - - $method->setBody($body); - } - - if ($classGenerator->hasMethod('__destruct')) { - $destructor = $classGenerator->getMethod('__destruct'); - $body = $destructor->getBody(); - $newBody = preg_replace('/^(\$this->initializer[a-zA-Z0-9]++) && .*;\n\nreturn (\$this->valueHolder)/', '$1 || $2', $body); - - if ($body === $newBody) { - throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method "%s::__destruct()".', $originalClass->name)); - } - - $destructor->setBody($newBody); } if (0 === strpos($originalClass->getFilename(), __FILE__)) { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index cd7642911a..070347d853 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -11,9 +11,7 @@ namespace Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper; -use ProxyManager\Exception\ExceptionInterface; use ProxyManager\Generator\ClassGenerator; -use ProxyManager\Generator\MethodGenerator; use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface; @@ -84,18 +82,6 @@ EOF; $code = $this->classGenerator->generate($this->generateProxyClass($definition)); $code = preg_replace('/^(class [^ ]++ extends )([^\\\\])/', '$1\\\\$2', $code); - if (!method_exists(MethodGenerator::class, 'fromReflectionWithoutBodyAndDocBlock')) { // proxy-manager < 2.2 - $code = preg_replace( - '/((?:\$(?:this|initializer|instance)->)?(?:publicProperties|initializer|valueHolder))[0-9a-f]++/', - '${1}'.$this->getIdentifierSuffix($definition), - $code - ); - } - - if (!is_subclass_of(ExceptionInterface::class, 'Throwable')) { // proxy-manager < 2.5 - $code = preg_replace('/ \\\\Closure::bind\(function ((?:& )?\(\$instance(?:, \$value)?\))/', ' \Closure::bind(static function \1', $code); - } - return $code; } @@ -114,8 +100,10 @@ EOF; $generatedClass = new ClassGenerator($this->getProxyClassName($definition)); $class = $this->proxyGenerator->getProxifiedClass($definition); - $this->proxyGenerator->setFluentSafe($definition->hasTag('proxy')); - $this->proxyGenerator->generate(new \ReflectionClass($class), $generatedClass); + $this->proxyGenerator->generate(new \ReflectionClass($class), $generatedClass, [ + 'fluentSafe' => $definition->hasTag('proxy'), + 'skipDestructor' => true, + ]); return $generatedClass; } diff --git a/src/Symfony/Bridge/ProxyManager/README.md b/src/Symfony/Bridge/ProxyManager/README.md index 38d3d69645..f50fbd97eb 100644 --- a/src/Symfony/Bridge/ProxyManager/README.md +++ b/src/Symfony/Bridge/ProxyManager/README.md @@ -11,4 +11,4 @@ Resources [send Pull Requests](https://github.com/symfony/symfony/pulls) in the [main Symfony repository](https://github.com/symfony/symfony) -[1]: https://github.com/Ocramius/ProxyManager +[1]: https://github.com/FriendsOfPHP/proxy-manager-lts diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php index 684ff36581..324304f683 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php @@ -16,7 +16,7 @@ class SunnyInterface_%s implements \ProxyManager\Proxy\VirtualProxyInterface, \S $this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'dummy', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s; if ($this->valueHolder%s === $returnValue = $this->valueHolder%s->dummy()) { - $returnValue = $this; + return $this; } return $returnValue; @@ -26,8 +26,8 @@ class SunnyInterface_%s implements \ProxyManager\Proxy\VirtualProxyInterface, \S { $this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'dummyRef', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s; - if ($this->valueHolder%s === $returnValue = &$this->valueHolder%s->dummyRef()) { - $returnValue = $this; + if ($this->valueHolder%s === $returnValue = & $this->valueHolder%s->dummyRef()) { + return $this; } return $returnValue; @@ -38,7 +38,7 @@ class SunnyInterface_%s implements \ProxyManager\Proxy\VirtualProxyInterface, \S $this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'sunny', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s; if ($this->valueHolder%s === $returnValue = $this->valueHolder%s->sunny()) { - $returnValue = $this; + return $this; } return $returnValue; @@ -96,7 +96,7 @@ class SunnyInterface_%s implements \ProxyManager\Proxy\VirtualProxyInterface, \S $targetObject = $this->valueHolder%s; - return $targetObject->$name = $value; + $targetObject->$name = $value; return $targetObject->$name; } public function __isset($name) diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index fb32b177ac..ae8aa90e7d 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -18,15 +18,12 @@ "require": { "php": ">=7.2.5", "composer/package-versions-deprecated": "^1.8", - "symfony/dependency-injection": "^5.0", - "ocramius/proxy-manager": "~2.1" + "friendsofphp/proxy-manager-lts": "^1.0", + "symfony/dependency-injection": "^5.0" }, "require-dev": { "symfony/config": "^4.4|^5.0" }, - "conflict": { - "zendframework/zend-eventmanager": "2.6.0" - }, "autoload": { "psr-4": { "Symfony\\Bridge\\ProxyManager\\": "" }, "exclude-from-classmap": [ diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index 3f0a7ecda2..c8229f1049 100644 --- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -111,7 +111,7 @@ final class FormExtension extends AbstractExtension return $view->vars['value']; } - public function getFieldLabel(FormView $view): string + public function getFieldLabel(FormView $view): ?string { return $this->createFieldTranslation( $view->vars['label'], @@ -120,7 +120,7 @@ final class FormExtension extends AbstractExtension ); } - public function getFieldHelp(FormView $view): string + public function getFieldHelp(FormView $view): ?string { return $this->createFieldTranslation( $view->vars['help'], @@ -164,7 +164,7 @@ final class FormExtension extends AbstractExtension } } - private function createFieldTranslation(?string $value, array $parameters, $domain): string + private function createFieldTranslation(?string $value, array $parameters, $domain): ?string { if (!$this->translator || !$value || false === $domain) { return $value; diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 00f606662a..61049b607a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -74,7 +74,7 @@ abstract class AbstractController implements ServiceSubscriberInterface /** * Gets a container parameter by its name. * - * @return mixed + * @return array|bool|float|int|string|null */ protected function getParameter(string $name) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php b/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php index a0dd847535..217a29d7b1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php @@ -58,6 +58,8 @@ class TestContainer extends Container /** * {@inheritdoc} + * + * @return array|bool|float|int|string|null */ public function getParameter(string $name) { diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php index dc99a1c2dd..dc3d498e34 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php @@ -13,14 +13,18 @@ namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Security\Core\AuthenticationEvents; +use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; use Symfony\Component\Security\Http\Event\CheckPassportEvent; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\Event\LoginFailureEvent; use Symfony\Component\Security\Http\Event\LoginSuccessEvent; use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\SecurityEvents; /** * Makes sure all event listeners on the global dispatcher are also listening - * to events on the firewall-specific dipatchers. + * to events on the firewall-specific dispatchers. * * This compiler pass must be run after RegisterListenersPass of the * EventDispatcher component. @@ -31,7 +35,18 @@ use Symfony\Component\Security\Http\Event\LogoutEvent; */ class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface { - private static $eventBubblingEvents = [CheckPassportEvent::class, LoginFailureEvent::class, LoginSuccessEvent::class, LogoutEvent::class]; + private static $eventBubblingEvents = [ + CheckPassportEvent::class, + LoginFailureEvent::class, + LoginSuccessEvent::class, + LogoutEvent::class, + AuthenticationSuccessEvent::class, + InteractiveLoginEvent::class, + + // When events are registered by their name + AuthenticationEvents::AUTHENTICATION_SUCCESS, + SecurityEvents::INTERACTIVE_LOGIN, + ]; /** * {@inheritdoc} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php index adbbbb9f58..dcaef3a0c1 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php @@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Core\AuthenticationEvents; use Symfony\Component\Security\Http\Event\CheckPassportEvent; use Symfony\Component\Security\Http\Event\LoginSuccessEvent; use Symfony\Component\Security\Http\Event\LogoutEvent; @@ -53,13 +54,15 @@ class RegisterGlobalSecurityEventListenersPassTest extends TestCase $this->container->register('app.security_listener', \stdClass::class) ->addTag('kernel.event_listener', ['method' => 'onLogout', 'event' => LogoutEvent::class]) - ->addTag('kernel.event_listener', ['method' => 'onLoginSuccess', 'event' => LoginSuccessEvent::class, 'priority' => 20]); + ->addTag('kernel.event_listener', ['method' => 'onLoginSuccess', 'event' => LoginSuccessEvent::class, 'priority' => 20]) + ->addTag('kernel.event_listener', ['method' => 'onAuthenticationSuccess', 'event' => AuthenticationEvents::AUTHENTICATION_SUCCESS]); $this->container->compile(); $this->assertListeners([ [LogoutEvent::class, ['app.security_listener', 'onLogout'], 0], [LoginSuccessEvent::class, ['app.security_listener', 'onLoginSuccess'], 20], + [AuthenticationEvents::AUTHENTICATION_SUCCESS, ['app.security_listener', 'onAuthenticationSuccess'], 0], ]); } @@ -79,6 +82,7 @@ class RegisterGlobalSecurityEventListenersPassTest extends TestCase [LogoutEvent::class, [TestSubscriber::class, 'onLogout'], -200], [CheckPassportEvent::class, [TestSubscriber::class, 'onCheckPassport'], 120], [LoginSuccessEvent::class, [TestSubscriber::class, 'onLoginSuccess'], 0], + [AuthenticationEvents::AUTHENTICATION_SUCCESS, [TestSubscriber::class, 'onAuthenticationSuccess'], 0], ]); } @@ -95,17 +99,20 @@ class RegisterGlobalSecurityEventListenersPassTest extends TestCase $this->container->register('app.security_listener', \stdClass::class) ->addTag('kernel.event_listener', ['method' => 'onLogout', 'event' => LogoutEvent::class]) - ->addTag('kernel.event_listener', ['method' => 'onLoginSuccess', 'event' => LoginSuccessEvent::class, 'priority' => 20]); + ->addTag('kernel.event_listener', ['method' => 'onLoginSuccess', 'event' => LoginSuccessEvent::class, 'priority' => 20]) + ->addTag('kernel.event_listener', ['method' => 'onAuthenticationSuccess', 'event' => AuthenticationEvents::AUTHENTICATION_SUCCESS]); $this->container->compile(); $this->assertListeners([ [LogoutEvent::class, ['app.security_listener', 'onLogout'], 0], [LoginSuccessEvent::class, ['app.security_listener', 'onLoginSuccess'], 20], + [AuthenticationEvents::AUTHENTICATION_SUCCESS, ['app.security_listener', 'onAuthenticationSuccess'], 0], ], 'security.event_dispatcher.main'); $this->assertListeners([ [LogoutEvent::class, ['app.security_listener', 'onLogout'], 0], [LoginSuccessEvent::class, ['app.security_listener', 'onLoginSuccess'], 20], + [AuthenticationEvents::AUTHENTICATION_SUCCESS, ['app.security_listener', 'onAuthenticationSuccess'], 0], ], 'security.event_dispatcher.api'); } @@ -122,13 +129,15 @@ class RegisterGlobalSecurityEventListenersPassTest extends TestCase $this->container->register('app.security_listener', \stdClass::class) ->addTag('kernel.event_listener', ['method' => 'onLogout', 'event' => LogoutEvent::class, 'dispatcher' => 'security.event_dispatcher.main']) - ->addTag('kernel.event_listener', ['method' => 'onLoginSuccess', 'event' => LoginSuccessEvent::class, 'priority' => 20]); + ->addTag('kernel.event_listener', ['method' => 'onLoginSuccess', 'event' => LoginSuccessEvent::class, 'priority' => 20]) + ->addTag('kernel.event_listener', ['method' => 'onAuthenticationSuccess', 'event' => AuthenticationEvents::AUTHENTICATION_SUCCESS]); $this->container->compile(); $this->assertListeners([ [LogoutEvent::class, ['app.security_listener', 'onLogout'], 0], [LoginSuccessEvent::class, ['app.security_listener', 'onLoginSuccess'], 20], + [AuthenticationEvents::AUTHENTICATION_SUCCESS, ['app.security_listener', 'onAuthenticationSuccess'], 0], ], 'security.event_dispatcher.main'); } @@ -146,7 +155,8 @@ class RegisterGlobalSecurityEventListenersPassTest extends TestCase } $foundListeners = array_uintersect($expectedListeners, $actualListeners, function (array $a, array $b) { - return $a === $b; + // PHP internally sorts all the arrays first, so returning proper 1 / -1 values is crucial + return $a <=> $b; }); $this->assertEquals($expectedListeners, $foundListeners); @@ -161,6 +171,7 @@ class TestSubscriber implements EventSubscriberInterface LogoutEvent::class => ['onLogout', -200], CheckPassportEvent::class => ['onCheckPassport', 120], LoginSuccessEvent::class => 'onLoginSuccess', + AuthenticationEvents::AUTHENTICATION_SUCCESS => 'onAuthenticationSuccess', ]; } } diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index deb23ad343..7140ddb5a1 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -43,6 +43,8 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} + * + * @return mixed */ public function get() { diff --git a/src/Symfony/Component/Cache/Psr16Cache.php b/src/Symfony/Component/Cache/Psr16Cache.php index dc7a70add6..3f25dec59b 100644 --- a/src/Symfony/Component/Cache/Psr16Cache.php +++ b/src/Symfony/Component/Cache/Psr16Cache.php @@ -66,6 +66,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return mixed */ public function get($key, $default = null) { diff --git a/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php index 2001a95617..4f3c19eb30 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php +++ b/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php @@ -34,6 +34,8 @@ class ServiceLocator extends BaseServiceLocator /** * {@inheritdoc} + * + * @return mixed */ public function get($id) { diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 1a4a0b7053..2654dceb62 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -109,7 +109,7 @@ class Container implements ContainerInterface, ResetInterface * * @param string $name The parameter name * - * @return mixed The parameter value + * @return array|bool|float|int|string|null The parameter value * * @throws InvalidArgumentException if the parameter is not defined */ diff --git a/src/Symfony/Component/DependencyInjection/ContainerInterface.php b/src/Symfony/Component/DependencyInjection/ContainerInterface.php index c73b102443..2391179d96 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -71,7 +71,7 @@ interface ContainerInterface extends PsrContainerInterface * * @param string $name The parameter name * - * @return mixed The parameter value + * @return array|bool|float|int|string|null The parameter value * * @throws InvalidArgumentException if the parameter is not defined */ diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 56dfe03f03..53925bf0bf 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1512,6 +1512,9 @@ EOF; $code = <<<'EOF' + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (isset($this->buildParameters[$name])) { diff --git a/src/Symfony/Component/DependencyInjection/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/ServiceLocator.php index 41f6c97d44..58558112a1 100644 --- a/src/Symfony/Component/DependencyInjection/ServiceLocator.php +++ b/src/Symfony/Component/DependencyInjection/ServiceLocator.php @@ -33,6 +33,11 @@ class ServiceLocator implements ServiceProviderInterface private $externalId; private $container; + /** + * {@inheritdoc} + * + * @return mixed + */ public function get($id) { if (!$this->externalId) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index 6470a2f19f..9f059a80d9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -532,6 +532,9 @@ class DecoratedServiceLocator implements ServiceProviderInterface $this->locator = $locator; } + /** + * @return mixed + */ public function get($id) { return $this->locator->get($id); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index 3a3cb14991..3299552cb6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -56,6 +56,9 @@ class ProjectServiceContainer extends Container return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index b87194357e..ac48497f24 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -56,6 +56,9 @@ class ProjectServiceContainer extends Container return $this->services['test'] = new \stdClass(('file://'.\dirname(__DIR__, 1)), [('file://'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php index 9c0d437a70..0411a2710d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php @@ -71,6 +71,9 @@ class ProjectServiceContainer extends Container return $instance; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php index 9359ad506e..bbb572eabb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php @@ -67,6 +67,9 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container return $this->services['test'] = new ${($_ = $this->getEnv('FOO')) && false ?: "_"}($this->getEnv('Bar'), 'foo'.$this->getEnv('string:FOO').'baz', $this->getEnv('int:Baz')); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php index a1f2b09a55..097f8f86d5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -43,6 +43,9 @@ class ProjectServiceContainer extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt index c7291046ca..650bbd8a2a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt @@ -823,6 +823,9 @@ class ProjectServiceContainer extends Container return $instance; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (isset($this->buildParameters[$name])) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 671a1b11b3..05e730c0f3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -421,6 +421,9 @@ class ProjectServiceContainer extends Container return new \SimpleFactoryClass('foo'); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt index cf0543d4ee..7868062deb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt @@ -476,6 +476,9 @@ class ProjectServiceContainer extends Container return new \SimpleFactoryClass('foo'); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (isset($this->buildParameters[$name])) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt index fbbb83a3e3..913f430319 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt @@ -91,6 +91,9 @@ class ProjectServiceContainer extends Container return new \Bar\FooClass(new \Bar\FooLazyClass()); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (isset($this->buildParameters[$name])) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php index db12b595ef..c117396b6c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php @@ -60,6 +60,9 @@ class ProjectServiceContainer extends Container return $instance; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php index 790808d9de..00fe01460f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php @@ -43,6 +43,9 @@ class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php index 719f76f9a9..1c1cc9ffd8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php @@ -43,6 +43,9 @@ class Symfony_DI_PhpDumper_Test_CsvParameters extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php index be9bdd9531..778d526669 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php @@ -43,6 +43,9 @@ class Symfony_DI_PhpDumper_Test_DefaultParameters extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php index 5817df19a4..fbcb43ff4b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php @@ -69,6 +69,9 @@ class ProjectServiceContainer extends Container return $this->services['foo'] = new \stdClass(($this->privates['bar_%env(BAR)%'] ?? ($this->privates['bar_%env(BAR)%'] = new \stdClass())), ['baz_'.$this->getEnv('string:BAR') => new \stdClass()]); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php index 99595f6478..4a16f2cb69 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php @@ -421,6 +421,9 @@ class Symfony_DI_PhpDumper_Errored_Definition extends Container return new \SimpleFactoryClass('foo'); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php index bc792c19f3..21ab8be609 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php @@ -89,6 +89,9 @@ class ProjectServiceContainer extends Container return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3()); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php index e491affc93..474e89fa10 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php @@ -43,6 +43,9 @@ class Symfony_DI_PhpDumper_Test_JsonParameters extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php index cc8e5fb836..7da3b4688d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php @@ -43,6 +43,9 @@ class Symfony_DI_PhpDumper_Test_QueryStringParameters extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php index c5ac15991b..0bb94cf01f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php @@ -74,6 +74,9 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container ]); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php index 8c864c59ae..ab1598ebbf 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php @@ -78,6 +78,9 @@ class Symfony_DI_PhpDumper_Test_Unsupported_Characters extends Container return $this->services['foo*/oh-no'] = new \FooClass(); } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php index fc1e2e3201..072c50f244 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php @@ -43,6 +43,9 @@ class Symfony_DI_PhpDumper_Test_UrlParameters extends Container ]; } + /** + * @return array|bool|float|int|string|null + */ public function getParameter(string $name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php index 5a9669e92b..4d59b73583 100644 --- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php @@ -37,7 +37,9 @@ class TranslationFilesTest extends TestCase { $document = new \DOMDocument(); $document->loadXML(file_get_contents($filePath)); - libxml_disable_entity_loader(true); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader(true); + } $errors = XliffUtils::validateSchema($document); diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php index 4255e91d92..c0607ed107 100644 --- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php @@ -36,7 +36,9 @@ class TranslationFilesTest extends TestCase { $document = new \DOMDocument(); $document->loadXML(file_get_contents($filePath)); - libxml_disable_entity_loader(true); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader(true); + } $errors = XliffUtils::validateSchema($document); diff --git a/src/Symfony/Component/Security/Http/Authenticator/LoginLinkAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/LoginLinkAuthenticator.php index 10efa444b2..0973a95958 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/LoginLinkAuthenticator.php +++ b/src/Symfony/Component/Security/Http/Authenticator/LoginLinkAuthenticator.php @@ -17,6 +17,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; @@ -69,7 +70,7 @@ final class LoginLinkAuthenticator extends AbstractAuthenticator implements Inte return $user; }), - [] + [new RememberMeBadge()] ); } diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php index e0fe7cd1b1..7e533398d9 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php @@ -17,6 +17,7 @@ use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; use Symfony\Component\Security\Http\Authenticator\LoginLinkAuthenticator; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; use Symfony\Component\Security\Http\HttpUtils; @@ -105,6 +106,17 @@ class LoginLinkAuthenticatorTest extends TestCase $this->authenticator->authenticate($request); } + public function testPassportBadges() + { + $this->setUpAuthenticator(); + + $request = Request::create('/login/link/check?stuff=1&user=weaverryan'); + + $passport = $this->authenticator->authenticate($request); + + $this->assertTrue($passport->hasBadge(RememberMeBadge::class)); + } + private function setUpAuthenticator(array $options = []) { $this->authenticator = new LoginLinkAuthenticator($this->loginLinkHandler, new HttpUtils(), $this->successHandler, $this->failureHandler, $options); diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php index 6e0620b517..7fa81d9fe0 100644 --- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php @@ -36,7 +36,9 @@ class TranslationFilesTest extends TestCase { $document = new \DOMDocument(); $document->loadXML(file_get_contents($filePath)); - libxml_disable_entity_loader(true); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader(true); + } $errors = XliffUtils::validateSchema($document); diff --git a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php index 1737f50e99..da797edca5 100644 --- a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php +++ b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php @@ -50,6 +50,8 @@ trait ServiceLocatorTrait /** * {@inheritdoc} + * + * @return mixed */ public function get($id) {