diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index 6bd14a10e3ba7..1779e607688d1 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -7,6 +7,52 @@ in 4.0 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.0.0...v4.0.1 +* 4.0.0-BETA2 (2017-10-30) + + * bug #24728 [Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless (arkste) + * bug #24709 [HttpKernel] Move services reset to Kernel::handle()+boot() (nicolas-grekas) + * bug #24703 [TwigBridge] Bootstrap 4 form theme fixes (vudaltsov) + * bug #24744 debug:container --types: Fix bug with non-existent classes (weaverryan) + * bug #24747 [VarDumper] HtmlDumper: fix collapsing nodes with depth < maxDepth (ogizanagi) + * bug #24743 [FrameworkBundle] Do not activate the cache if Doctrine's cache is not present (sroze) + * bug #24605 [FrameworkBundle] Do not load property_access.xml if the component isn't installed (ogizanagi) + * bug #24710 [TwigBridge] Fix template paths in profiler (ro0NL) + * bug #24706 [DependencyInjection] Add the possibility to disable assets via xml (renatomefi) + * bug #24696 Ensure DeprecationErrorHandler::collectDeprecations() is triggered (alexpott) + * bug #24711 [TwigBridge] Re-add Bootstrap 3 Checkbox Layout (arkste) + * bug #24713 [FrameworkBundle] fix CachePoolPrunerPass to use correct command service id (kbond) + * bug #24686 Fix $_ENV/$_SERVER precedence in test framework (fabpot) + * bug #24691 [HttpFoundation] Fix caching of session-enabled pages (nicolas-grekas) + * feature #24677 [HttpFoundation] Allow DateTimeImmutable in Response setters (derrabus) + * bug #24694 [Intl] Allow passing null as a locale fallback (jakzal) + * bug #24606 [HttpFoundation] Fix FileBag issue with associative arrays (enumag) + * bug #24673 [DI] Throw when a service name or an alias contains dynamic values (prevent an infinite loop) (dunglas) + * bug #24684 [Security] remove invalid deprecation notice on AbstractGuardAuthenticator::supports() (kbond) + * bug #24681 Fix isolated error handling (alexpott) + * bug #24575 Ensure that PHPUnit's error handler is still working in isolated tests (alexpott) + * bug #24597 [PhpUnitBridge] fix deprecation triggering test detection (xabbuh) + * feature #24671 [DI] Handle container.autowiring.strict_mode to opt-out from legacy autowiring (nicolas-grekas) + * bug #24660 Escape trailing \ in QuestionHelper autocompletion (kamazee) + * bug #24624 [Security] Fix missing BC layer for AbstractGuardAuthenticator::getCredentials() (chalasr) + * bug #24598 Prefer line formatter on missing cli dumper (greg0ire) + * bug #24635 [DI] Register default env var provided types (ro0NL) + * bug #24620 [FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command (Jean-Beru) + * bug #24644 [Security] Fixed auth provider authenticate() cannot return void (glye) + * bug #24642 [Routing] Fix resource miss (dunglas) + * bug #24608 Adding the Form default theme files to be warmed up in Twig's cache (weaverryan) + * bug #24626 streamed response should return $this (DQNEO) + * feature #24631 [Form] Fix FormEvents::* constant and value matching (yceruto, javiereguiluz) + * bug #24630 [WebServerBundle] Prevent commands from being registered by convention (chalasr) + * bug #24589 Username and password in basic auth are allowed to contain '.' (Richard Quadling) + * bug #24566 Fixed unsetting from loosely equal keys OrderedHashMap (maryo) + * bug #24570 [Debug] Fix same vendor detection in class loader (Jean-Beru) + * bug #24573 Fixed pathinfo calculation for requests starting with a question mark. (syzygymsu) + * bug #24565 [Serializer] YamlEncoder: throw if the Yaml component isn't installed (dunglas) + * bug #24563 [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed (dunglas) + * bug #24571 [PropertyInfo] Add support for the iterable type (dunglas) + * bug #24579 pdo session fix (mxp100) + * bug #24536 [Security] Reject remember-me token if UserCheckerInterface::checkPostAuth() fails (kbond) + * 4.0.0-BETA1 (2017-10-19) * feature #24583 Adding a new debug:autowiring command (weaverryan) diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index 40d864222a4ba..d20f403d5aaf6 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -84,7 +84,7 @@ DependencyInjection * Autowiring services based on the types they implement is deprecated and won't be supported in version 4.0. Rename (or alias) your services to their FQCN id to make them autowirable. - * [BC BREAK] The `NullDumper` class has been made final + * The `NullDumper` class has been made final * [BC BREAK] `_defaults` and `_instanceof` are now reserved service names in Yaml configurations. Please rename any services with that names. diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 1b9a40c452dde..b3058828ce3f6 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -1,6 +1,11 @@ UPGRADE FROM 3.3 to 3.4 ======================= +Config +------ + + * The protected `TreeBuilder::$builder` property is deprecated and will be removed in 4.0. + DependencyInjection ------------------- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 000fd2fc059d8..e4aec3709008d 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -6,6 +6,11 @@ ClassLoader * The component has been removed. Use Composer instead. +Config +------ + + * The protected `TreeBuilder::$builder` property has been removed. + Console ------- @@ -226,6 +231,10 @@ Finder Form ---- +* The values of the `FormEvents::*` constants have been updated to match the + constant names. You should only update your application if you relied on the + constant values instead of their names. + * The `choices_as_values` option of the `ChoiceType` has been removed. * Support for data objects that implements both `Traversable` and @@ -326,6 +335,8 @@ Form } ``` + * `FormRendererInterface::setTheme` and `FormRendererEngineInterface::setTheme` have a new optional argument `$useDefaultThemes` with a default value set to `true`. + FrameworkBundle --------------- diff --git a/composer.json b/composer.json index 52aa4ed70a2a2..be5f08dab76e2 100644 --- a/composer.json +++ b/composer.json @@ -84,6 +84,7 @@ }, "require-dev": { "cache/integration-tests": "dev-master", + "doctrine/annotations": "~1.0", "doctrine/cache": "~1.6", "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.4", diff --git a/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php b/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php index 9725fdcc088f9..9bf22357df895 100644 --- a/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php +++ b/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php @@ -26,9 +26,6 @@ class ProxyCacheWarmer implements CacheWarmerInterface { private $registry; - /** - * @param ManagerRegistry $registry A ManagerRegistry instance - */ public function __construct(ManagerRegistry $registry) { $this->registry = $registry; diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 941d77cf591a2..9ba6912e0fae7 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -26,8 +26,6 @@ class ContainerAwareEventManager extends EventManager * Map of registered listeners. * * => - * - * @var array */ private $listeners = array(); private $initialized = array(); diff --git a/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php b/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php index 93cd2c11f9a4d..7ccd1df106f70 100644 --- a/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php +++ b/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php @@ -25,14 +25,8 @@ */ class ContainerAwareLoader extends Loader { - /** - * @var ContainerInterface - */ private $container; - /** - * @param ContainerInterface $container A ContainerInterface instance - */ public function __construct(ContainerInterface $container) { $this->container = $container; diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index 5c0518c8483ce..5c04c5c97aecc 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -26,15 +26,11 @@ abstract class AbstractDoctrineExtension extends Extension { /** * Used inside metadata driver method to simplify aggregation of data. - * - * @var array */ protected $aliasMap = array(); /** * Used inside metadata driver method to simplify aggregation of data. - * - * @var array */ protected $drivers = array(); @@ -141,10 +137,6 @@ protected function setMappingDriverConfig(array $mappingConfig, $mappingName) * * Returns false when autodetection failed, an array of the completed information otherwise. * - * @param array $bundleConfig - * @param \ReflectionClass $bundle - * @param ContainerBuilder $container A ContainerBuilder instance - * * @return array|false */ protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container) @@ -407,9 +399,6 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD * * The manager called $autoMappedManager will map all bundles that are not mapped by other managers. * - * @param array $managerConfigs - * @param array $bundles - * * @return array The modified version of $managerConfigs */ protected function fixManagersAutoMappings(array $managerConfigs, array $bundles) @@ -469,8 +458,6 @@ abstract protected function getMappingResourceExtension(); /** * Search for a manager that is declared as 'auto_mapping' = true. * - * @param array $managerConfigs - * * @return null|string The name of the manager. If no one manager is found, returns null * * @throws \LogicException diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php index 695e20bfc9f61..045f0edaedcf7 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php @@ -134,8 +134,6 @@ public function __construct($driver, array $namespaces, array $managerParameters /** * Register mappings and alias with the metadata drivers. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { @@ -167,8 +165,6 @@ public function process(ContainerBuilder $container) * Get the service name of the metadata chain driver that the mappings * should be registered with. * - * @param ContainerBuilder $container - * * @return string The name of the chain driver service * * @throws InvalidArgumentException if non of the managerParameters has a @@ -195,8 +191,6 @@ protected function getDriver(ContainerBuilder $container) /** * Get the service name from the pattern and the configured manager name. * - * @param ContainerBuilder $container - * * @return string a service definition name * * @throws InvalidArgumentException if none of the managerParameters has a @@ -213,8 +207,6 @@ private function getConfigurationServiceName(ContainerBuilder $container) * The default implementation loops over the managerParameters and returns * the first non-empty parameter. * - * @param ContainerBuilder $container - * * @return string The name of the active manager * * @throws InvalidArgumentException if none of the managerParameters is found in the container @@ -243,8 +235,6 @@ private function getManagerName(ContainerBuilder $container) * This default implementation checks if the class has the enabledParameter * configured and if so if that parameter is present in the container. * - * @param ContainerBuilder $container - * * @return bool whether this compiler pass really should register the mappings */ protected function enabled(ContainerBuilder $container) diff --git a/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php b/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php index e56674be351c5..307361a52a3ef 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php +++ b/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php @@ -24,8 +24,6 @@ class CollectionToArrayTransformer implements DataTransformerInterface /** * Transforms a collection into an array. * - * @param Collection $collection A collection of entities - * * @return mixed An array of entities * * @throws TransformationFailedException diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php index 21f1860efd6e8..4b07e83652c66 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php @@ -87,8 +87,6 @@ public function getQueryBuilderPartsForCachingHash($queryBuilder) /** * Converts a query parameter to an array. * - * @param Parameter $parameter The query parameter - * * @return array The array representation of the parameter */ private function parameterToArray(Parameter $parameter) diff --git a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php index eccc60e7c42c0..42574edcade56 100644 --- a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php +++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php @@ -26,10 +26,6 @@ class DbalLogger implements SQLLogger protected $logger; protected $stopwatch; - /** - * @param LoggerInterface $logger A LoggerInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - */ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null) { $this->logger = $logger; diff --git a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php index b2216b7ae31df..f35984068f937 100644 --- a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php @@ -37,19 +37,8 @@ */ class DoctrineTokenProvider implements TokenProviderInterface { - /** - * Doctrine DBAL database connection - * F.ex. service id: doctrine.dbal.default_connection. - * - * @var Connection - */ private $conn; - /** - * new DoctrineTokenProvider for the RememberMe authentication service. - * - * @param Connection $conn - */ public function __construct(Connection $conn) { $this->conn = $conn; diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index 135f53f493fc1..82558c724af9b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -268,8 +268,6 @@ protected function invokeLoadCacheDriver(array $objectManager, ContainerBuilder } /** - * @param array $data - * * @return \Symfony\Component\DependencyInjection\ContainerBuilder */ protected function createContainer(array $data = array()) diff --git a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php index e78c9d0c9d622..65e99f6f87b75 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php @@ -22,9 +22,6 @@ */ class ChromePhpHandler extends BaseChromePhpHandler { - /** - * @var array - */ private $headers = array(); /** diff --git a/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php b/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php index a3a2af2135189..04943779dd241 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Monolog\Handler; +use Monolog\Formatter\LineFormatter; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Logger; use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; @@ -20,6 +21,7 @@ use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\VarDumper\Dumper\CliDumper; /** * Writes logs to the console output depending on its verbosity setting. @@ -40,14 +42,7 @@ */ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscriberInterface { - /** - * @var OutputInterface|null - */ private $output; - - /** - * @var array - */ private $verbosityLevelMap = array( OutputInterface::VERBOSITY_QUIET => Logger::ERROR, OutputInterface::VERBOSITY_NORMAL => Logger::WARNING, @@ -93,8 +88,6 @@ public function handle(array $record) /** * Sets the console output to use for printing logs. - * - * @param OutputInterface $output The console output to use */ public function setOutput(OutputInterface $output) { @@ -114,8 +107,6 @@ public function close() /** * Before a command is executed, the handler gets activated and the console output * is set in order to know where to write the logs. - * - * @param ConsoleCommandEvent $event */ public function onCommand(ConsoleCommandEvent $event) { @@ -129,8 +120,6 @@ public function onCommand(ConsoleCommandEvent $event) /** * After a command has been executed, it disables the output. - * - * @param ConsoleTerminateEvent $event */ public function onTerminate(ConsoleTerminateEvent $event) { @@ -162,6 +151,9 @@ protected function write(array $record) */ protected function getDefaultFormatter() { + if (!class_exists(CliDumper::class)) { + return new LineFormatter(); + } if (!$this->output) { return new ConsoleFormatter(); } diff --git a/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php b/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php index 339843c1d4ff5..056496ae1325a 100644 --- a/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php @@ -22,9 +22,6 @@ */ class FirePHPHandler extends BaseFirePHPHandler { - /** - * @var array - */ private $headers = array(); /** diff --git a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php index 0412e94f223a3..fcbd98ac7dc64 100644 --- a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php @@ -26,9 +26,6 @@ class SwiftMailerHandler extends BaseSwiftMailerHandler protected $instantFlush = false; - /** - * @param \Swift_Transport $transport - */ public function setTransport(\Swift_Transport $transport) { $this->transport = $transport; @@ -36,8 +33,6 @@ public function setTransport(\Swift_Transport $transport) /** * After the kernel has been terminated we will always flush messages. - * - * @param PostResponseEvent $event */ public function onKernelTerminate(PostResponseEvent $event) { @@ -46,8 +41,6 @@ public function onKernelTerminate(PostResponseEvent $event) /** * After the CLI application has been terminated we will always flush messages. - * - * @param ConsoleTerminateEvent $event */ public function onCliTerminate(ConsoleTerminateEvent $event) { diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index a7dbc08e0c6c2..a108126a2eed8 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -116,8 +116,16 @@ public static function register($mode = 0) } if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) { - $class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class']; - $method = $trace[$i]['function']; + if (isset($trace[$i]['class']) && in_array($trace[$i]['class'], array('Symfony\Bridge\PhpUnit\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'), true)) { + $parsedMsg = unserialize($msg); + $msg = $parsedMsg['deprecation']; + $class = $parsedMsg['class']; + $method = $parsedMsg['method']; + } else { + $class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class']; + $method = $trace[$i]['function']; + } + $Test = $UtilPrefix.'Test'; if (0 !== error_reporting()) { @@ -243,10 +251,19 @@ public static function collectDeprecations($outputFile) $deprecations = array(); $previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, &$previousErrorHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { - return $previousErrorHandler ? $previousErrorHandler($type, $msg, $file, $line, $context) : false; + if ($previousErrorHandler) { + return $previousErrorHandler($type, $msg, $file, $line, $context); + } + static $autoload = true; + + $ErrorHandler = class_exists('PHPUnit_Util_ErrorHandler', $autoload) ? 'PHPUnit_Util_ErrorHandler' : 'PHPUnit\Util\ErrorHandler'; + $autoload = false; + + return $ErrorHandler::handleError($type, $msg, $file, $line, $context); } $deprecations[] = array(error_reporting(), $msg); }); + register_shutdown_function(function () use ($outputFile, &$deprecations) { file_put_contents($outputFile, serialize($deprecations)); }); diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php index 9945ac5b472fb..729cdac0ebbbe 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php @@ -253,11 +253,12 @@ public function endTest($test, $time) if ($this->runsInSeparateProcess) { $deprecations = file_get_contents($this->runsInSeparateProcess); unlink($this->runsInSeparateProcess); + putenv('SYMFONY_DEPRECATIONS_SERIALIZE'); foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) { if ($deprecation[0]) { - trigger_error($deprecation[1], E_USER_DEPRECATED); + trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED); } else { - @trigger_error($deprecation[1], E_USER_DEPRECATED); + @trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED); } } $this->runsInSeparateProcess = false; @@ -301,6 +302,12 @@ public function handleError($type, $msg, $file, $line, $context = array()) return $h ? $h($type, $msg, $file, $line, $context) : false; } + // If the message is serialized we need to extract the message. This occurs when the error is triggered by + // by the isolated test path in \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest(). + $parsedMsg = @unserialize($msg); + if (is_array($parsedMsg)) { + $msg = $parsedMsg['deprecation']; + } if (error_reporting()) { $msg = 'Unsilenced deprecation: '.$msg; } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php index 0cfbe515ee9e4..ec8f124a5f2c1 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php @@ -21,4 +21,17 @@ public function testIsolation() @trigger_error('Test abc', E_USER_DEPRECATED); $this->addToAssertionCount(1); } + + public function testCallingOtherErrorHandler() + { + $class = class_exists('PHPUnit\Framework\Exception') ? 'PHPUnit\Framework\Exception' : 'PHPUnit_Framework_Exception'; + if (method_exists($this, 'expectException')) { + $this->expectException($class); + $this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.'); + } else { + $this->setExpectedException($class, 'Test that PHPUnit\'s error handler fires.'); + } + + trigger_error('Test that PHPUnit\'s error handler fires.', E_USER_WARNING); + } } diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 277bb73753580..ac358dd4bed8e 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -68,7 +68,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) { passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); } - passthru("$COMPOSER require --no-update symfony/phpunit-bridge \">=3.3.11@dev\""); + passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"~3.3.11@dev|~3.4.0-beta2@dev|^4.0.0-beta2@dev\""); $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true))); diff --git a/src/Symfony/Bridge/PhpUnit/bootstrap.php b/src/Symfony/Bridge/PhpUnit/bootstrap.php index 2803caf02bcae..a265a129e6fdc 100644 --- a/src/Symfony/Bridge/PhpUnit/bootstrap.php +++ b/src/Symfony/Bridge/PhpUnit/bootstrap.php @@ -12,12 +12,15 @@ use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; +// Detect if we need to serialize deprecations to a file. +if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) { + DeprecationErrorHandler::collectDeprecations($file); + + return; +} + // Detect if we're loaded by an actual run of phpunit if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) { - if ($ser = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) { - DeprecationErrorHandler::collectDeprecations($ser); - } - return; } diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 72d8702a12ff2..20dc223c5d155 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -108,8 +108,6 @@ public function getProxyCode(Definition $definition) /** * Produces the proxy class name for the given definition. * - * @param Definition $definition - * * @return string */ private function getProxyClassName(Definition $definition) diff --git a/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php b/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php index d1bcb5ad1a6d8..83c1db5170dd7 100644 --- a/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php +++ b/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php @@ -63,9 +63,18 @@ public function lateCollect() $this->data['template_paths'] = array(); $templateFinder = function (Profile $profile) use (&$templateFinder) { - if ($profile->isTemplate() && $template = $this->twig->load($profile->getName())->getSourceContext()->getPath()) { - $this->data['template_paths'][$profile->getName()] = $template; + if ($profile->isTemplate()) { + try { + $template = $this->twig->load($name = $profile->getName()); + } catch (\Twig_Error_Loader $e) { + $template = null; + } + + if (null !== $template && '' !== $path = $template->getSourceContext()->getPath()) { + $this->data['template_paths'][$name] = $path; + } } + foreach ($profile as $p) { $templateFinder($p); } diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index c2866abb857a7..c3c08fc650240 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -70,9 +70,9 @@ public function abbrMethod($method) list($class, $method) = explode('::', $method, 2); $result = sprintf('%s::%s()', $this->abbrClass($class), $method); } elseif ('Closure' === $method) { - $result = sprintf('%s', $method, $method); + $result = sprintf('%1$s', $method); } else { - $result = sprintf('%s()', $method, $method); + $result = sprintf('%1$s()', $method); } return $result; diff --git a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php index 2d19857c96a00..54c12f16d4cb5 100644 --- a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php @@ -85,7 +85,7 @@ public function hasMarkedPlace($subject, $placeName, $name = null) * Returns marked places. * * @param object $subject A subject - * @param string $placesNameOnly If true, returns only places name. If false returns the raw representation + * @param bool $placesNameOnly If true, returns only places name. If false returns the raw representation * @param string $name A workflow name * * @return string[]|int[] diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php index 1284cf52a20b7..1c3451bbebf46 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php @@ -16,24 +16,10 @@ */ class Scope { - /** - * @var Scope|null - */ private $parent; - - /** - * @var array - */ private $data = array(); - - /** - * @var bool - */ private $left = false; - /** - * @param Scope $parent - */ public function __construct(Scope $parent = null) { $this->parent = $parent; diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php index 01f230b9efdff..1fbce9c6af811 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php @@ -123,8 +123,6 @@ private function getReadDomainFromArguments(Node $arguments, $index) } /** - * @param Node $node - * * @return string|null */ private function getReadDomainFromNode(Node $node) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig index 478de622da435..f0c4626daf45e 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig @@ -8,14 +8,12 @@ {# Labels #} {% block form_label -%} -{% spaceless %} - {% if label is same as(false) %} + {%- if label is same as(false) -%}
- {% else %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %} + {%- else -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} {{- parent() -}} - {% endif %} -{% endspaceless %} + {%- endif -%} {%- endblock form_label %} {% block form_label_class -%} @@ -35,27 +33,33 @@ col-sm-2 {%- endblock form_row %} {% block submit_row -%} -{% spaceless %} -
-
+
{#--#} +
{#--#}
- {{ form_widget(form) }} -
+ {{- form_widget(form) -}} +
{#--#}
-{% endspaceless %} -{% endblock submit_row %} +{%- endblock submit_row %} {% block reset_row -%} -{% spaceless %} -
-
+
{#--#} +
{#--#}
- {{ form_widget(form) }} -
+ {{- form_widget(form) -}} +
{#--#}
-{% endspaceless %} -{% endblock reset_row %} +{%- endblock reset_row %} {% block form_group_class -%} col-sm-10 {%- endblock form_group_class %} + +{% block checkbox_row -%} +
{#--#} +
{#--#} +
+ {{- form_widget(form) -}} + {{- form_errors(form) -}} +
{#--#} +
+{%- endblock checkbox_row %} \ No newline at end of file diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 07ca81f5061ee..64fc2a210ee3e 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -10,7 +10,7 @@ {%- endblock form_widget_simple %} {% block button_widget -%} - {% set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) %} + {%- set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) -%} {{- parent() -}} {%- endblock button_widget %} @@ -22,18 +22,18 @@
{{- form_label(form, null, { widget: parent() }) -}}
- {%- endif %} + {%- endif -%} {%- endblock checkbox_widget %} {% block radio_widget -%} {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} - {% if 'radio-inline' in parent_label_class %} + {%- if 'radio-inline' in parent_label_class -%} {{- form_label(form, null, { widget: parent() }) -}} - {% else -%} + {%- else -%}
{{- form_label(form, null, { widget: parent() }) -}}
- {%- endif %} + {%- endif -%} {%- endblock radio_widget %} {# Labels #} @@ -61,30 +61,30 @@ {{- block('checkbox_radio_label') -}} {%- endblock radio_label %} -{% block checkbox_radio_label %} +{% block checkbox_radio_label -%} {# Do not display the label if widget is not defined in order to prevent double label rendering #} - {% if widget is defined %} - {% if required %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} - {% endif %} - {% if parent_label_class is defined %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} - {% endif %} - {% if label is not same as(false) and label is empty %} + {%- if widget is defined -%} + {%- if required -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} + {%- endif -%} + {%- if parent_label_class is defined -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) -%} + {%- endif -%} + {%- if label is not same as(false) and label is empty -%} {%- if label_format is not empty -%} - {% set label = label_format|replace({ + {%- set label = label_format|replace({ '%name%': name, '%id%': id, - }) %} + }) -%} {%- else -%} {% set label = name|humanize %} {%- endif -%} - {% endif %} + {%- endif -%} {{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}} - {% endif %} -{% endblock checkbox_radio_label %} + {%- endif -%} +{%- endblock checkbox_radio_label %} {# Rows #} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig index 32b4944bab3d0..e236d12cb709a 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig @@ -47,23 +47,33 @@ col-sm-2 {%- endblock fieldset_form_row %} {% block submit_row -%} -
-
+
{#--#} +
{#--#}
{{- form_widget(form) -}} -
+
{#--#}
{%- endblock submit_row %} {% block reset_row -%} -
-
+
{#--#} +
{#--#}
{{- form_widget(form) -}} -
+
{#--#}
{%- endblock reset_row %} {% block form_group_class -%} col-sm-10 {%- endblock form_group_class %} + +{% block checkbox_row -%} +
{#--#} +
{#--#} +
+ {{- form_widget(form) -}} + {{- form_errors(form) -}} +
{#--#} +
+{%- endblock checkbox_row %} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index 7dda32ace2fc4..2407b16d9b99a 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -24,9 +24,9 @@ {% block checkbox_widget -%} {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} {%- set attr = attr|merge({class: attr.class|default('form-check-input')}) -%} - {%- if 'checkbox-inline' in parent_label_class -%} + {% if 'checkbox-inline' in parent_label_class %} {{- form_label(form, null, { widget: parent() }) -}} - {%- else -%} + {% else -%}
{{- form_label(form, null, { widget: parent() }) -}}
@@ -70,11 +70,12 @@ {# Labels #} {% block form_label -%} - {%- if expanded is defined and expanded -%} + {%- if compound is defined and compound -%} {%- set element = 'legend' -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-legend')|trim}) -%} + {%- else -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} {%- endif -%} - {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} {{- parent() -}} {%- endblock form_label %} @@ -107,7 +108,7 @@ {# Rows #} {% block form_row -%} - {%- if expanded is defined and expanded -%} + {%- if compound is defined and compound -%} {%- set element = 'fieldset' -%} {%- endif -%} <{{ element|default('div') }} class="form-group"> diff --git a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php index b96a8affe50d3..86c5d54167db2 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php @@ -102,6 +102,6 @@ public function testCompile() protected function getVariableGetter($name) { - return sprintf('($context["%s"] ?? null)', $name, $name); + return sprintf('($context["%s"] ?? null)', $name); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php index 6263c92ad90e7..4e4215c5ad8f2 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php @@ -271,6 +271,6 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes() protected function getVariableGetter($name) { - return sprintf('($context["%s"] ?? null)', $name, $name); + return sprintf('($context["%s"] ?? null)', $name); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php index 3a8c2ef6fa717..2074eeb93c013 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php @@ -44,15 +44,15 @@ public function testCompileStrict() protected function getVariableGetterWithoutStrictCheck($name) { - return sprintf('($context["%s"] ?? null)', $name, $name); + return sprintf('($context["%s"] ?? null)', $name); } protected function getVariableGetterWithStrictCheck($name) { if (Environment::MAJOR_VERSION >= 2) { - return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name); + return sprintf('(isset($context["%s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%1$s" does not exist.\', 0, $this->getSourceContext()); })())', $name); } - return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name); + return sprintf('($context["%s"] ?? $this->getContext($context, "%1$s"))', $name); } } diff --git a/src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php index 3ead804e7e6ca..2388cc56623be 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php @@ -27,8 +27,6 @@ class FormThemeTokenParser extends AbstractTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node */ public function parse(Token $token) diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php index 2b4a9f3fc4636..5261d7ad52cee 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php @@ -29,8 +29,6 @@ class TransChoiceTokenParser extends TransTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node * * @throws SyntaxError diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php index 4096a011a300d..ee546e05f0125 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php @@ -26,8 +26,6 @@ class TransDefaultDomainTokenParser extends AbstractTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node */ public function parse(Token $token) diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php index 848a080710fa1..76c8dc06100c1 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php @@ -30,8 +30,6 @@ class TransTokenParser extends AbstractTokenParser /** * Parses a token and returns a node. * - * @param Token $token - * * @return Node * * @throws SyntaxError diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 98977ab8a6ec7..3f29c199dd889 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -24,7 +24,7 @@ "symfony/asset": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", "symfony/finder": "~3.4|~4.0", - "symfony/form": "~3.4|~4.0", + "symfony/form": "~3.4-beta2|~4.0-beta2", "symfony/http-foundation": "~3.4|~4.0", "symfony/http-kernel": "~3.4|~4.0", "symfony/polyfill-intl-icu": "~1.0", diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplatePathsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplatePathsCacheWarmer.php index 4b8c63331eddf..434b883e96dd5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplatePathsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplatePathsCacheWarmer.php @@ -25,10 +25,6 @@ class TemplatePathsCacheWarmer extends CacheWarmer protected $finder; protected $locator; - /** - * @param TemplateFinderInterface $finder A template finder - * @param TemplateLocator $locator The template locator - */ public function __construct(TemplateFinderInterface $finder, TemplateLocator $locator) { $this->finder = $finder; diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index 801eabb9b609c..64fcc5c8157a1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -103,12 +103,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->table(array(), $rows); } - private static function formatPath($path, $baseDir = null) + private static function formatPath(string $path, string $baseDir = null): string { return null !== $baseDir ? preg_replace('~^'.preg_quote($baseDir, '~').'~', '.', $path) : $path; } - private static function formatFileSize($path) + private static function formatFileSize(string $path): string { if (is_file($path)) { $size = filesize($path) ?: 0; @@ -122,14 +122,14 @@ private static function formatFileSize($path) return Helper::formatMemory($size); } - private static function isExpired($date) + private static function isExpired(string $date): bool { $date = \DateTime::createFromFormat('m/Y', $date); return false !== $date && new \DateTime() > $date->modify('last day of this month 23:59:59'); } - private static function getDotEnvVars() + private static function getDotEnvVars(): array { $vars = array(); foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index cda58bd97f373..21355aa8b8504 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -185,13 +185,8 @@ protected function execute(InputInterface $input, OutputInterface $output) * Try to create relative symlink. * * Falling back to absolute symlink and finally hard copy. - * - * @param string $originDir - * @param string $targetDir - * - * @return string */ - private function relativeSymlinkWithFallback($originDir, $targetDir) + private function relativeSymlinkWithFallback(string $originDir, string $targetDir): string { try { $this->symlink($originDir, $targetDir, true); @@ -207,13 +202,8 @@ private function relativeSymlinkWithFallback($originDir, $targetDir) * Try to create absolute symlink. * * Falling back to hard copy. - * - * @param string $originDir - * @param string $targetDir - * - * @return string */ - private function absoluteSymlinkWithFallback($originDir, $targetDir) + private function absoluteSymlinkWithFallback(string $originDir, string $targetDir): string { try { $this->symlink($originDir, $targetDir); @@ -229,13 +219,9 @@ private function absoluteSymlinkWithFallback($originDir, $targetDir) /** * Creates symbolic link. * - * @param string $originDir - * @param string $targetDir - * @param bool $relative - * * @throws IOException if link can not be created */ - private function symlink($originDir, $targetDir, $relative = false) + private function symlink(string $originDir, string $targetDir, bool $relative = false) { if ($relative) { $originDir = $this->filesystem->makePathRelative($originDir, realpath(dirname($targetDir))); @@ -248,13 +234,8 @@ private function symlink($originDir, $targetDir, $relative = false) /** * Copies origin to target. - * - * @param string $originDir - * @param string $targetDir - * - * @return string */ - private function hardCopy($originDir, $targetDir) + private function hardCopy(string $originDir, string $targetDir): string { $this->filesystem->mkdir($targetDir, 0777); // We use a custom iterator to ignore VCS files diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 1bb9c4c530402..bc0f980e51da4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -117,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); } - private function warmupCache(InputInterface $input, OutputInterface $output, $realCacheDir, $oldCacheDir) + private function warmupCache(InputInterface $input, OutputInterface $output, string $realCacheDir, string $oldCacheDir) { $io = new SymfonyStyle($input, $output); @@ -145,12 +145,7 @@ private function warmupCache(InputInterface $input, OutputInterface $output, $re $this->filesystem->rename($warmupDir, $realCacheDir); } - /** - * @param string $warmupDir - * @param string $realCacheDir - * @param bool $enableOptionalWarmers - */ - private function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = true) + private function warmup(string $warmupDir, string $realCacheDir, bool $enableOptionalWarmers = true) { // create a temporary kernel $kernel = $this->getApplication()->getKernel(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index 5a55332b334f3..d2fb64e763d62 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Exception\LogicException; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Yaml\Yaml; /** @@ -112,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->writeln(Yaml::dump($config, 10)); } - private function compileContainer() + private function compileContainer(): ContainerBuilder { $kernel = clone $this->getApplication()->getKernel(); $kernel->boot(); @@ -128,13 +129,11 @@ private function compileContainer() /** * Iterate over configuration until the last step of the given path. * - * @param array $config A bundle configuration - * * @throws LogicException If the configuration does not exist * * @return mixed */ - private function getConfigForPath(array $config, $path, $alias) + private function getConfigForPath(array $config, string $path, string $alias) { $steps = explode('.', $path); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index cbf9e8bdb6faa..fb5d2536f5f8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -153,8 +153,6 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * Validates input arguments and options. * - * @param InputInterface $input - * * @throws \InvalidArgumentException */ protected function validateInput(InputInterface $input) @@ -244,7 +242,18 @@ public function filterToServiceTypes($serviceId) return false; } - // see if the class exists (only need to trigger autoload once) - return class_exists($serviceId) || interface_exists($serviceId, false); + // if the id has a \, assume it is a class + if (false !== strpos($serviceId, '\\')) { + return true; + } + + try { + $r = new \ReflectionClass($serviceId); + + return true; + } catch (\ReflectionException $e) { + // the service id is not a valid class/interface + return false; + } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php index 3e16726a41940..4bcea1082770d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php @@ -217,7 +217,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->table($headers, $rows); } - private function formatState($state) + private function formatState($state): string { if (self::MESSAGE_MISSING === $state) { return ' missing '; @@ -234,7 +234,7 @@ private function formatState($state) return $state; } - private function formatStates(array $states) + private function formatStates(array $states): string { $result = array(); foreach ($states as $state) { @@ -244,12 +244,12 @@ private function formatStates(array $states) return implode(' ', $result); } - private function formatId($id) + private function formatId(string $id): string { return sprintf('%s', $id); } - private function sanitizeString($string, $length = 40) + private function sanitizeString(string $string, int $length = 40): string { $string = trim(preg_replace('/\s+/', ' ', $string)); @@ -264,13 +264,7 @@ private function sanitizeString($string, $length = 40) return $string; } - /** - * @param string $locale - * @param array $transPaths - * - * @return MessageCatalogue - */ - private function extractMessages($locale, $transPaths) + private function extractMessages(string $locale, array $transPaths): MessageCatalogue { $extractedCatalogue = new MessageCatalogue($locale); foreach ($transPaths as $path) { @@ -283,13 +277,7 @@ private function extractMessages($locale, $transPaths) return $extractedCatalogue; } - /** - * @param string $locale - * @param array $transPaths - * - * @return MessageCatalogue - */ - private function loadCurrentMessages($locale, $transPaths) + private function loadCurrentMessages(string $locale, array $transPaths): MessageCatalogue { $currentCatalogue = new MessageCatalogue($locale); foreach ($transPaths as $path) { @@ -303,12 +291,9 @@ private function loadCurrentMessages($locale, $transPaths) } /** - * @param string $locale - * @param array $transPaths - * * @return MessageCatalogue[] */ - private function loadFallbackCatalogues($locale, $transPaths) + private function loadFallbackCatalogues(string $locale, array $transPaths): array { $fallbackCatalogues = array(); if ($this->translator instanceof Translator || $this->translator instanceof DataCollectorTranslator || $this->translator instanceof LoggingTranslator) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index f5df6dd3f426a..c16c4dcf14a2a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -41,7 +41,7 @@ class TranslationUpdateCommand extends Command private $extractor; private $defaultLocale; - public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, $defaultLocale) + public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale) { parent::__construct(); @@ -242,7 +242,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $errorIo->success($resultMessage.'.'); } - private function filterCatalogue(MessageCatalogue $catalogue, $domain) + private function filterCatalogue(MessageCatalogue $catalogue, string $domain): MessageCatalogue { $filteredCatalogue = new MessageCatalogue($catalogue->getLocale()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 892bdf90fea59..c4f9426423a50 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -33,9 +33,6 @@ class Application extends BaseApplication private $commandsRegistered = false; private $registrationErrors = array(); - /** - * @param KernelInterface $kernel A KernelInterface instance - */ public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; @@ -59,9 +56,6 @@ public function getKernel() /** * Runs the current application. * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * * @return int 0 if everything went fine, or an error code */ public function doRun(InputInterface $input, OutputInterface $output) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 206b01e4f056e..043b4fff6e078 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -102,33 +102,21 @@ protected function write($content, $decorated = false) /** * Describes an InputArgument instance. - * - * @param RouteCollection $routes - * @param array $options */ abstract protected function describeRouteCollection(RouteCollection $routes, array $options = array()); /** * Describes an InputOption instance. - * - * @param Route $route - * @param array $options */ abstract protected function describeRoute(Route $route, array $options = array()); /** * Describes container parameters. - * - * @param ParameterBag $parameters - * @param array $options */ abstract protected function describeContainerParameters(ParameterBag $parameters, array $options = array()); /** * Describes container tags. - * - * @param ContainerBuilder $builder - * @param array $options */ abstract protected function describeContainerTags(ContainerBuilder $builder, array $options = array()); @@ -149,34 +137,21 @@ abstract protected function describeContainerService($service, array $options = * * Common options are: * * tag: filters described services by given tag - * - * @param ContainerBuilder $builder - * @param array $options */ abstract protected function describeContainerServices(ContainerBuilder $builder, array $options = array()); /** * Describes a service definition. - * - * @param Definition $definition - * @param array $options */ abstract protected function describeContainerDefinition(Definition $definition, array $options = array()); /** * Describes a service alias. - * - * @param Alias $alias - * @param array $options - * @param ContainerBuilder|null $builder */ abstract protected function describeContainerAlias(Alias $alias, array $options = array(), ContainerBuilder $builder = null); /** * Describes a container parameter. - * - * @param string $parameter - * @param array $options */ abstract protected function describeContainerParameter($parameter, array $options = array()); @@ -185,9 +160,6 @@ abstract protected function describeContainerParameter($parameter, array $option * * Common options are: * * name: name of listened event - * - * @param EventDispatcherInterface $eventDispatcher - * @param array $options */ abstract protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = array()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index dccca775c98e1..a019e6c4b03e7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -180,9 +180,6 @@ protected function describeContainerParameter($parameter, array $options = array /** * Writes data as json. * - * @param array $data - * @param array $options - * * @return array|string */ private function writeData(array $data, array $options) @@ -192,8 +189,6 @@ private function writeData(array $data, array $options) } /** - * @param Route $route - * * @return array */ protected function getRouteData(Route $route) @@ -273,8 +268,6 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = } /** - * @param Alias $alias - * * @return array */ private function getContainerAliasData(Alias $alias) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 4bf3c5d5a32c9..2efee2ed1d1b9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -361,8 +361,6 @@ protected function describeCallable($callable, array $options = array()) } /** - * @param array $array - * * @return string */ private function formatRouterConfig(array $array) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index c28cf12bd389b..ff57f478fdd18 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -413,9 +413,6 @@ protected function describeCallable($callable, array $options = array()) $this->writeText($this->formatCallable($callable), $options); } - /** - * @param array $array - */ private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, $event, array $eventListeners, SymfonyStyle $io) { $tableHeaders = array('Order', 'Callable', 'Priority'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index 5baa8de11c730..79fd76004503f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -133,8 +133,6 @@ protected function describeContainerParameter($parameter, array $options = array /** * Writes DOM document. * - * @param \DOMDocument $dom - * * @return \DOMDocument|string */ private function writeDocument(\DOMDocument $dom) @@ -144,8 +142,6 @@ private function writeDocument(\DOMDocument $dom) } /** - * @param RouteCollection $routes - * * @return \DOMDocument */ private function getRouteCollectionDocument(RouteCollection $routes) @@ -231,8 +227,6 @@ private function getRouteDocument(Route $route, $name = null) } /** - * @param ParameterBag $parameters - * * @return \DOMDocument */ private function getContainerParametersDocument(ParameterBag $parameters) @@ -483,9 +477,6 @@ private function getContainerAliasDocument(Alias $alias, $id = null) } /** - * @param string $parameter - * @param array $options - * * @return \DOMDocument */ private function getContainerParameterDocument($parameter, $options = array()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php index 3d5a3f8a5aa27..49c33c06503a7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php @@ -24,9 +24,6 @@ class ControllerNameParser { protected $kernel; - /** - * @param KernelInterface $kernel A KernelInterface instance - */ public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php index e42703b941e35..f0ac2a248faee 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php @@ -23,11 +23,6 @@ class ControllerResolver extends ContainerControllerResolver { protected $parser; - /** - * @param ContainerInterface $container A ContainerInterface instance - * @param ControllerNameParser $parser A ControllerNameParser instance - * @param LoggerInterface $logger A LoggerInterface instance - */ public function __construct(ContainerInterface $container, ControllerNameParser $parser, LoggerInterface $logger = null) { $this->parser = $parser; diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php index 487481623e9b7..8e6ce84408d09 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php @@ -30,7 +30,7 @@ class RedirectController private $httpPort; private $httpsPort; - public function __construct(UrlGeneratorInterface $router = null, $httpPort = null, $httpsPort = null) + public function __construct(UrlGeneratorInterface $router = null, int $httpPort = null, int $httpsPort = null) { $this->router = $router; $this->httpPort = $httpPort; @@ -51,11 +51,9 @@ public function __construct(UrlGeneratorInterface $router = null, $httpPort = nu * @param bool $permanent Whether the redirection is permanent * @param bool|array $ignoreAttributes Whether to ignore attributes or an array of attributes to ignore * - * @return Response A Response instance - * * @throws HttpException In case the route name is empty */ - public function redirectAction(Request $request, $route, $permanent = false, $ignoreAttributes = false) + public function redirectAction(Request $request, string $route, bool $permanent = false, $ignoreAttributes = false): Response { if ('' == $route) { throw new HttpException($permanent ? 410 : 404); @@ -89,11 +87,9 @@ public function redirectAction(Request $request, $route, $permanent = false, $ig * @param int|null $httpPort The HTTP port (null to keep the current one for the same scheme or the default configured port) * @param int|null $httpsPort The HTTPS port (null to keep the current one for the same scheme or the default configured port) * - * @return Response A Response instance - * * @throws HttpException In case the path is empty */ - public function urlRedirectAction(Request $request, $path, $permanent = false, $scheme = null, $httpPort = null, $httpsPort = null) + public function urlRedirectAction(Request $request, string $path, bool $permanent = false, string $scheme = null, int $httpPort = null, int $httpsPort = null): Response { if ('' == $path) { throw new HttpException($permanent ? 410 : 404); diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php index 65eb35fc2a2fd..c15cde111578b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php @@ -40,10 +40,8 @@ public function __construct(Environment $twig = null, EngineInterface $templatin * @param int|null $maxAge Max age for client caching * @param int|null $sharedAge Max age for shared (proxy) caching * @param bool|null $private Whether or not caching should apply for client caches only - * - * @return Response A Response instance */ - public function templateAction($template, $maxAge = null, $sharedAge = null, $private = null) + public function templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null): Response { if ($this->templating) { $response = new Response($this->templating->render($template)); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPrunerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPrunerPass.php index cd79f58ce84cd..d02e2c372c3d4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPrunerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPrunerPass.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; +use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand; use Symfony\Component\Cache\PruneableInterface; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -26,7 +27,7 @@ class CachePoolPrunerPass implements CompilerPassInterface private $cacheCommandServiceId; private $cachePoolTag; - public function __construct($cacheCommandServiceId = 'cache.command.pool_pruner', $cachePoolTag = 'cache.pool') + public function __construct($cacheCommandServiceId = CachePoolPruneCommand::class, $cachePoolTag = 'cache.pool') { $this->cacheCommandServiceId = $cacheCommandServiceId; $this->cachePoolTag = $cachePoolTag; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 563be13f495e1..b80fc7017b442 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; use Doctrine\Common\Annotations\Annotation; +use Doctrine\Common\Cache\Cache; use Symfony\Bundle\FullStack; use Symfony\Component\Asset\Package; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; @@ -676,7 +677,7 @@ private function addAnnotationsSection(ArrayNodeDefinition $rootNode) ->info('annotation configuration') ->{class_exists(Annotation::class) ? 'canBeDisabled' : 'canBeEnabled'}() ->children() - ->scalarNode('cache')->defaultValue('php_array')->end() + ->scalarNode('cache')->defaultValue(interface_exists(Cache::class) ? 'php_array' : 'none')->end() ->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end() ->booleanNode('debug')->defaultValue($this->debug)->end() ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 57809f21b49e1..c044f6e676922 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -67,16 +67,11 @@ use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; use Symfony\Component\Routing\Loader\AnnotationFileLoader; use Symfony\Component\Security\Core\Security; -use Symfony\Component\Serializer\Encoder\CsvEncoder; use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfony\Component\Serializer\Encoder\EncoderInterface; -use Symfony\Component\Serializer\Encoder\YamlEncoder; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; -use Symfony\Component\Serializer\Normalizer\DataUriNormalizer; use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer; -use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; -use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Translation\Command\XliffLintCommand as BaseXliffLintCommand; @@ -111,9 +106,6 @@ class FrameworkExtension extends Extension /** * Responds to the app.config configuration parameter. * - * @param array $configs - * @param ContainerBuilder $container - * * @throws LogicException */ public function load(array $configs, ContainerBuilder $container) @@ -135,9 +127,6 @@ public function load(array $configs, ContainerBuilder $container) } } - // Property access is used by both the Form and the Validator component - $loader->load('property_access.xml'); - // Load Cache configuration first as it is used by other components $loader->load('cache.xml'); @@ -245,7 +234,7 @@ public function load(array $configs, ContainerBuilder $container) $this->registerDebugConfiguration($config['php_errors'], $container, $loader); $this->registerRouterConfiguration($config['router'], $container, $loader); $this->registerAnnotationsConfiguration($config['annotations'], $container, $loader); - $this->registerPropertyAccessConfiguration($config['property_access'], $container); + $this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader); if ($this->isConfigEnabled($container, $config['serializer'])) { $this->registerSerializerConfiguration($config['serializer'], $container, $loader); @@ -333,16 +322,7 @@ public function getConfiguration(array $config, ContainerBuilder $container) return new Configuration($container->getParameter('kernel.debug')); } - /** - * Loads Form configuration. - * - * @param array $config A configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - * - * @throws \LogicException - */ - private function registerFormConfiguration($config, ContainerBuilder $container, XmlFileLoader $loader) + private function registerFormConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('form.xml'); @@ -364,13 +344,6 @@ private function registerFormConfiguration($config, ContainerBuilder $container, } } - /** - * Loads the ESI configuration. - * - * @param array $config An ESI configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerEsiConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -382,13 +355,6 @@ private function registerEsiConfiguration(array $config, ContainerBuilder $conta $loader->load('esi.xml'); } - /** - * Loads the SSI configuration. - * - * @param array $config An SSI configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerSsiConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -400,13 +366,6 @@ private function registerSsiConfiguration(array $config, ContainerBuilder $conta $loader->load('ssi.xml'); } - /** - * Loads the fragments configuration. - * - * @param array $config A fragments configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerFragmentsConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -419,15 +378,6 @@ private function registerFragmentsConfiguration(array $config, ContainerBuilder $container->setParameter('fragment.path', $config['path']); } - /** - * Loads the profiler configuration. - * - * @param array $config A profiler configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - * - * @throws \LogicException - */ private function registerProfilerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -471,19 +421,10 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $ ->addTag('kernel.reset', array('method' => 'reset')); } - /** - * Loads the workflow configuration. - * - * @param array $config A workflow configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$config['enabled']) { - if (!class_exists(Workflow\Workflow::class)) { - $container->removeDefinition(WorkflowDumpCommand::class); - } + $container->removeDefinition(WorkflowDumpCommand::class); return; } @@ -610,13 +551,6 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ } } - /** - * Loads the debug configuration. - * - * @param array $config A php errors configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerDebugConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('debug_prod.xml'); @@ -659,13 +593,6 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con } } - /** - * Loads the router configuration. - * - * @param array $config A router configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerRouterConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -714,13 +641,6 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co } } - /** - * Loads the session configuration. - * - * @param array $config A session configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerSessionConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('session.xml'); @@ -750,13 +670,6 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c $container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']); } - /** - * Loads the request configuration. - * - * @param array $config A request configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerRequestConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if ($config['formats']) { @@ -769,13 +682,6 @@ private function registerRequestConfiguration(array $config, ContainerBuilder $c } } - /** - * Loads the templating configuration. - * - * @param array $config A templating configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerTemplatingConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('templating.xml'); @@ -858,13 +764,6 @@ private function registerTemplatingConfiguration(array $config, ContainerBuilder } } - /** - * Loads the assets configuration. - * - * @param array $config A assets configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerAssetsConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('assets.xml'); @@ -948,12 +847,6 @@ private function createVersion(ContainerBuilder $container, $version, $format, $ return new Reference('assets.empty_version_strategy'); } - /** - * Loads the translator configuration. - * - * @param array $config A translator configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - */ private function registerTranslatorConfiguration(array $config, ContainerBuilder $container, LoaderInterface $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -1042,13 +935,6 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder } } - /** - * Loads the validator configuration. - * - * @param array $config A validation configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerValidationConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->validatorConfigEnabled = $this->isConfigEnabled($container, $config)) { @@ -1207,8 +1093,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde } } - private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container) + private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { + if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) { + return; + } + + $loader->load('property_access.xml'); + $container ->getDefinition('property_accessor') ->replaceArgument(0, $config['magic_call']) @@ -1216,15 +1108,6 @@ private function registerPropertyAccessConfiguration(array $config, ContainerBui ; } - /** - * Loads the security configuration. - * - * @param array $config A CSRF configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - * - * @throws \LogicException - */ private function registerSecurityCsrfConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { @@ -1243,59 +1126,21 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild $loader->load('security_csrf.xml'); } - /** - * Loads the serializer configuration. - * - * @param array $config A serializer configuration array - * @param ContainerBuilder $container A ContainerBuilder instance - * @param XmlFileLoader $loader An XmlFileLoader instance - */ private function registerSerializerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { - if (class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) { - // Run before serializer.normalizer.object - $definition = $container->register('serializer.normalizer.data_uri', DataUriNormalizer::class); - $definition->setPublic(false); - $definition->addTag('serializer.normalizer', array('priority' => -920)); - } - - if (class_exists(DateIntervalNormalizer::class)) { - // Run before serializer.normalizer.object - $definition = $container->register('serializer.normalizer.dateinterval', DateIntervalNormalizer::class); - $definition->setPublic(false); - $definition->addTag('serializer.normalizer', array('priority' => -915)); - } - - if (class_exists('Symfony\Component\Serializer\Normalizer\DateTimeNormalizer')) { - // Run before serializer.normalizer.object - $definition = $container->register('serializer.normalizer.datetime', DateTimeNormalizer::class); - $definition->setPublic(false); - $definition->addTag('serializer.normalizer', array('priority' => -910)); - } + $loader->load('serializer.xml'); - if (class_exists('Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer')) { - // Run before serializer.normalizer.object - $definition = $container->register('serializer.normalizer.json_serializable', JsonSerializableNormalizer::class); - $definition->setPublic(false); - $definition->addTag('serializer.normalizer', array('priority' => -900)); + if (!class_exists(DateIntervalNormalizer::class)) { + $container->removeDefinition('serializer.normalizer.dateinterval'); } - if (class_exists(YamlEncoder::class) && defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) { - $definition = $container->register('serializer.encoder.yaml', YamlEncoder::class); - $definition->setPublic(false); - $definition->addTag('serializer.encoder'); - } + $chainLoader = $container->getDefinition('serializer.mapping.chain_loader'); - if (class_exists(CsvEncoder::class)) { - $definition = $container->register('serializer.encoder.csv', CsvEncoder::class); - $definition->setPublic(false); - $definition->addTag('serializer.encoder'); + if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) { + $container->removeAlias('serializer.property_accessor'); + $container->removeDefinition('serializer.normalizer.object'); } - $loader->load('serializer.xml'); - - $chainLoader = $container->getDefinition('serializer.mapping.chain_loader'); - $serializerLoaders = array(); if (isset($config['enable_annotations']) && $config['enable_annotations']) { if (!$this->annotationsConfigEnabled) { @@ -1341,7 +1186,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder $chainLoader->replaceArgument(0, $serializerLoaders); $container->getDefinition('serializer.mapping.cache_warmer')->replaceArgument(0, $serializerLoaders); - if (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) { + if (!$container->getParameter('kernel.debug')) { $cacheMetadataFactory = new Definition( CacheClassMetadataFactory::class, array( @@ -1364,13 +1209,6 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder } } - /** - * Loads property info configuration. - * - * @param array $config - * @param ContainerBuilder $container - * @param XmlFileLoader $loader - */ private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) { $loader->load('property_info.xml'); @@ -1514,8 +1352,6 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con /** * Gets a hash of the kernel root directory. * - * @param ContainerBuilder $container - * * @return string */ private function getKernelRootHash(ContainerBuilder $container) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 181dd9334a80b..abdf9955791a5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -139,6 +139,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml index e517f57b0cd4d..4a5c276cdf8e4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml @@ -25,6 +25,26 @@ + + + + + + + + + + + + + + + + + + + + null @@ -77,6 +97,14 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml index 6c927610e72eb..ebedf8796ea19 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml @@ -61,10 +61,6 @@ - - - - - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 8c7f268e55f26..0148dbf73d86a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -84,8 +84,6 @@ public function warmUp($cacheDir) * - the route host, * - the route schemes, * - the route methods. - * - * @param RouteCollection $collection */ private function resolveParameters(RouteCollection $collection) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php b/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php index 25a5d88852e2b..81658ffa7bacd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php @@ -24,10 +24,6 @@ class DelegatingEngine extends BaseDelegatingEngine implements EngineInterface { protected $container; - /** - * @param ContainerInterface $container The DI container - * @param array $engineIds An array of engine Ids - */ public function __construct(ContainerInterface $container, array $engineIds) { $this->container = $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php index 5ebfea1793784..d1daf760dc79e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php @@ -25,9 +25,6 @@ class GlobalVariables { protected $container; - /** - * @param ContainerInterface $container The DI container - */ public function __construct(ContainerInterface $container) { $this->container = $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php index 8e1e242f01ac4..c0879c97f059f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php @@ -24,9 +24,6 @@ class ActionsHelper extends Helper { private $handler; - /** - * @param FragmentHandler $handler A FragmentHandler instance - */ public function __construct(FragmentHandler $handler) { $this->handler = $handler; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index c5ea489668ed3..fc17906330059 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -61,9 +61,9 @@ public function abbrMethod($method) list($class, $method) = explode('::', $method, 2); $result = sprintf('%s::%s()', $this->abbrClass($class), $method); } elseif ('Closure' === $method) { - $result = sprintf('%s', $method, $method); + $result = sprintf('%1$s', $method); } else { - $result = sprintf('%s()', $method, $method); + $result = sprintf('%1$s()', $method); } return $result; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index f7c2b2c6986bb..0ad1ff85b24a5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -23,14 +23,8 @@ */ class FormHelper extends Helper { - /** - * @var FormRendererInterface - */ private $renderer; - /** - * @param FormRendererInterface $renderer - */ public function __construct(FormRendererInterface $renderer) { $this->renderer = $renderer; @@ -178,8 +172,6 @@ public function label(FormView $view, $label = null, array $variables = array()) /** * Renders the errors of the given view. * - * @param FormView $view The view to render the errors for - * * @return string The HTML markup */ public function errors(FormView $view) diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php index a46608fa0c5ef..8e4adfee1b749 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php @@ -23,9 +23,6 @@ class RouterHelper extends Helper { protected $generator; - /** - * @param UrlGeneratorInterface $router A Router instance - */ public function __construct(UrlGeneratorInterface $router) { $this->generator = $router; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php index 9893c5e35c9c5..5c4a9ae0fa1c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php @@ -21,9 +21,6 @@ class TranslatorHelper extends Helper { protected $translator; - /** - * @param TranslatorInterface $translator A TranslatorInterface instance - */ public function __construct(TranslatorInterface $translator) { $this->translator = $translator; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/FilesystemLoader.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/FilesystemLoader.php index 402778bd76857..29031d03db31b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/FilesystemLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/FilesystemLoader.php @@ -25,9 +25,6 @@ class FilesystemLoader implements LoaderInterface { protected $locator; - /** - * @param FileLocatorInterface $locator A FileLocatorInterface instance - */ public function __construct(FileLocatorInterface $locator) { $this->locator = $locator; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php index bff0b3251200f..dc57cc0964c56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php @@ -42,8 +42,6 @@ public function __construct(FileLocatorInterface $locator, $cacheDir = null) /** * Returns a full path for a given file. * - * @param TemplateReferenceInterface $template A template - * * @return string The full path for the file */ protected function getCacheKey($template) diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php b/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php index ca68a2e3abb4a..4f1c7563cdc42 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php @@ -26,12 +26,6 @@ class PhpEngine extends BasePhpEngine implements EngineInterface { protected $container; - /** - * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance - * @param ContainerInterface $container The DI container - * @param LoaderInterface $loader A loader instance - * @param GlobalVariables|null $globals A GlobalVariables instance or null - */ public function __construct(TemplateNameParserInterface $parser, ContainerInterface $container, LoaderInterface $loader, GlobalVariables $globals = null) { $this->container = $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php index d0c91dcce8fea..9e614ca39acf2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php @@ -27,9 +27,6 @@ class TemplateNameParser extends BaseTemplateNameParser protected $kernel; protected $cache = array(); - /** - * @param KernelInterface $kernel A KernelInterface instance - */ public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TimedPhpEngine.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TimedPhpEngine.php index 390fff7fa961c..ec6a393ef5ad1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TimedPhpEngine.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TimedPhpEngine.php @@ -25,13 +25,6 @@ class TimedPhpEngine extends PhpEngine { protected $stopwatch; - /** - * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance - * @param ContainerInterface $container A ContainerInterface instance - * @param LoaderInterface $loader A LoaderInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param GlobalVariables $globals A GlobalVariables instance - */ public function __construct(TemplateNameParserInterface $parser, ContainerInterface $container, LoaderInterface $loader, Stopwatch $stopwatch, GlobalVariables $globals = null) { parent::__construct($parser, $container, $loader, $globals); diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index a400e1b377634..be396e055a739 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -38,10 +38,10 @@ abstract class KernelTestCase extends TestCase protected static function getKernelClass() { if (!isset($_SERVER['KERNEL_CLASS']) && !isset($_ENV['KERNEL_CLASS'])) { - throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the %1$::createKernel() or %1$::getKernelClass() method.', static::class)); + throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the %1$s::createKernel() or %1$s::getKernelClass() method.', static::class)); } - if (!class_exists($class = $_SERVER['KERNEL_CLASS'] ?? $_ENV['KERNEL_CLASS'])) { + if (!class_exists($class = $_ENV['KERNEL_CLASS'] ?? $_SERVER['KERNEL_CLASS'])) { throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class)); } @@ -51,8 +51,6 @@ protected static function getKernelClass() /** * Boots the Kernel for this test. * - * @param array $options - * * @return KernelInterface A KernelInterface instance */ protected static function bootKernel(array $options = array()) @@ -73,8 +71,6 @@ protected static function bootKernel(array $options = array()) * * environment * * debug * - * @param array $options An array of options - * * @return KernelInterface A KernelInterface instance */ protected static function createKernel(array $options = array()) @@ -85,20 +81,20 @@ protected static function createKernel(array $options = array()) if (isset($options['environment'])) { $env = $options['environment']; - } elseif (isset($_SERVER['APP_ENV'])) { - $env = $_SERVER['APP_ENV']; } elseif (isset($_ENV['APP_ENV'])) { $env = $_ENV['APP_ENV']; + } elseif (isset($_SERVER['APP_ENV'])) { + $env = $_SERVER['APP_ENV']; } else { $env = 'test'; } if (isset($options['debug'])) { $debug = $options['debug']; - } elseif (isset($_SERVER['APP_DEBUG'])) { - $debug = $_SERVER['APP_DEBUG']; } elseif (isset($_ENV['APP_DEBUG'])) { $debug = $_ENV['APP_DEBUG']; + } elseif (isset($_SERVER['APP_DEBUG'])) { + $debug = $_SERVER['APP_DEBUG']; } else { $debug = true; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php index 51dba222a3a44..0006070f51ddb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler; use PHPUnit\Framework\TestCase; +use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\PhpFilesAdapter; @@ -24,7 +25,7 @@ class CachePoolPrunerPassTest extends TestCase public function testCompilerPassReplacesCommandArgument() { $container = new ContainerBuilder(); - $container->register('cache.command.pool_pruner')->addArgument(array()); + $container->register(CachePoolPruneCommand::class)->addArgument(array()); $container->register('pool.foo', FilesystemAdapter::class)->addTag('cache.pool'); $container->register('pool.bar', PhpFilesAdapter::class)->addTag('cache.pool'); @@ -35,7 +36,7 @@ public function testCompilerPassReplacesCommandArgument() 'pool.foo' => new Reference('pool.foo'), 'pool.bar' => new Reference('pool.bar'), ); - $argument = $container->getDefinition('cache.command.pool_pruner')->getArgument(0); + $argument = $container->getDefinition(CachePoolPruneCommand::class)->getArgument(0); $this->assertInstanceOf(IteratorArgument::class, $argument); $this->assertEquals($expected, $argument->getValues()); @@ -51,7 +52,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist() $container ->expects($this->atLeastOnce()) ->method('hasDefinition') - ->with('cache.command.pool_pruner') + ->with(CachePoolPruneCommand::class) ->will($this->returnValue(false)); $container @@ -73,7 +74,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist() public function testCompilerPassThrowsOnInvalidDefinitionClass() { $container = new ContainerBuilder(); - $container->register('cache.command.pool_pruner')->addArgument(array()); + $container->register(CachePoolPruneCommand::class)->addArgument(array()); $container->register('pool.not-found', NotFound::class)->addTag('cache.pool'); $pass = new CachePoolPrunerPass(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 27bac878abcb9..d11835fec4ff3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -69,12 +69,11 @@ public function testAssetsCanBeEnabled() */ public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMessage) { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}( - InvalidConfigurationException::class, - $expectedMessage - ); - if (method_exists($this, 'expectExceptionMessage')) { + if (method_exists($this, 'expectException')) { + $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage($expectedMessage); + } else { + $this->setExpectedException(InvalidConfigurationException::class, $expectedMessage); } $processor = new Processor(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php new file mode 100644 index 0000000000000..3ade7047a100c --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php @@ -0,0 +1,7 @@ +loadFromExtension('framework', array( + 'assets' => array( + 'enabled' => false, + ), +)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets_disabled.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets_disabled.xml new file mode 100644 index 0000000000000..0ce70d275c324 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets_disabled.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets_disabled.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets_disabled.yml new file mode 100644 index 0000000000000..17ba4e90afb75 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets_disabled.yml @@ -0,0 +1,3 @@ +framework: + assets: + enabled: false diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 8542a2f4f05c6..aa99d09ff8d86 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -36,7 +36,6 @@ use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer; use Symfony\Component\Serializer\Serializer; -use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader; use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader; use Symfony\Component\Serializer\Normalizer\DataUriNormalizer; @@ -453,6 +452,13 @@ public function testAssetsDefaultVersionStrategyAsService() $this->assertEquals('assets.custom_version_strategy', (string) $defaultPackage->getArgument(1)); } + public function testAssetsCanBeDisabled() + { + $container = $this->createContainerFromFile('assets_disabled'); + + $this->assertFalse($container->has('templating.helper.assets'), 'The templating.helper.assets helper service is removed when assets are disabled.'); + } + public function testWebLink() { $container = $this->createContainerFromFile('web_link'); @@ -757,10 +763,6 @@ public function testRegisterSerializerExtractor() public function testDataUriNormalizerRegistered() { - if (!class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) { - $this->markTestSkipped('The DataUriNormalizer has been introduced in the Serializer Component version 3.1.'); - } - $container = $this->createContainerFromFile('full'); $definition = $container->getDefinition('serializer.normalizer.data_uri'); @@ -787,10 +789,6 @@ public function testDateIntervalNormalizerRegistered() public function testDateTimeNormalizerRegistered() { - if (!class_exists('Symfony\Component\Serializer\Normalizer\DateTimeNormalizer')) { - $this->markTestSkipped('The DateTimeNormalizer has been introduced in the Serializer Component version 3.1.'); - } - $container = $this->createContainerFromFile('full'); $definition = $container->getDefinition('serializer.normalizer.datetime'); @@ -802,10 +800,6 @@ public function testDateTimeNormalizerRegistered() public function testJsonSerializableNormalizerRegistered() { - if (!class_exists('Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer')) { - $this->markTestSkipped('The JsonSerializableNormalizer has been introduced in the Serializer Component version 3.1.'); - } - $container = $this->createContainerFromFile('full'); $definition = $container->getDefinition('serializer.normalizer.json_serializable'); @@ -828,10 +822,6 @@ public function testObjectNormalizerRegistered() public function testSerializerCacheActivated() { - if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) { - $this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.'); - } - $container = $this->createContainerFromFile('serializer_enabled'); $this->assertTrue($container->hasDefinition('serializer.mapping.cache_class_metadata_factory')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php index ee79850c47dfb..bc7dc12ebfbca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php @@ -11,8 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -use Symfony\Component\Serializer\Normalizer\DataUriNormalizer; - /** * @author Kévin Dunglas */ @@ -20,10 +18,6 @@ class SerializerTest extends WebTestCase { public function testDeserializeArrayOfObject() { - if (!class_exists(DataUriNormalizer::class)) { - $this->markTestSkipped('This test is only applicable when using the Symfony Serializer Component version 3.1 or superior.'); - } - static::bootKernel(array('test_case' => 'Serializer')); $container = static::$kernel->getContainer(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index 2876d5d735815..e0548078fca2c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -238,8 +238,6 @@ public function getNonStringValues() } /** - * @param RouteCollection $routes - * * @return \Symfony\Component\DependencyInjection\Container */ private function getServiceContainer(RouteCollection $routes) diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php index e53e45f28ad9a..a09d5c3651f96 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php @@ -164,10 +164,8 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * Create the password question to ask the user for the password to be encoded. - * - * @return Question */ - private function createPasswordQuestion() + private function createPasswordQuestion(): Question { $passwordQuestion = new Question('Type in your password to be encoded'); diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php index 3b928e0338c18..2e3a085a92cfb 100644 --- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php +++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php @@ -42,14 +42,6 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn private $firewall; private $hasVarDumper; - /** - * @param TokenStorageInterface|null $tokenStorage - * @param RoleHierarchyInterface|null $roleHierarchy - * @param LogoutUrlGenerator|null $logoutUrlGenerator - * @param AccessDecisionManagerInterface|null $accessDecisionManager - * @param FirewallMapInterface|null $firewallMap - * @param TraceableFirewallListener|null $firewall - */ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null) { $this->tokenStorage = $tokenStorage; @@ -304,9 +296,9 @@ public function getToken() } /** - * Get the provider key (i.e. the name of the active firewall). + * Get the logout URL. * - * @return string The provider key + * @return string The logout URL */ public function getLogoutUrl() { diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index 716d05a43d30b..0ca7e7f4b7f51 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -28,10 +28,6 @@ class MainConfiguration implements ConfigurationInterface private $factories; private $userProviderFactories; - /** - * @param array $factories - * @param array $userProviderFactories - */ public function __construct(array $factories, array $userProviderFactories) { $this->factories = $factories; diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php index 356e9f8327d2e..d1b7980faa8a6 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php @@ -144,8 +144,6 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint * Subclasses may disable remember-me features for the listener, by * always returning false from this method. * - * @param array $config - * * @return bool Whether a possibly configured RememberMeServices should be set for this listener */ protected function isRememberMeAware($config) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 0f1e21a5af740..64a4c4d32ff2e 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -116,13 +116,7 @@ public function load(array $configs, ContainerBuilder $container) ->addTag('security.voter'); } - /** - * Loads the web configuration. - * - * @param array $config An array of configuration settings - * @param ContainerBuilder $container A ContainerBuilder instance - */ - private function createRoleHierarchy($config, ContainerBuilder $container) + private function createRoleHierarchy(array $config, ContainerBuilder $container) { if (!isset($config['role_hierarchy']) || 0 === count($config['role_hierarchy'])) { $container->removeDefinition('security.access.role_hierarchy_voter'); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php index 02e8062c269f4..c3904dc2baf18 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php @@ -20,8 +20,6 @@ class MainConfigurationTest extends TestCase /** * The minimal, required config needed to not have any required validation * issues. - * - * @var array */ protected static $minimalConfig = array( 'providers' => array( diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php index a87f79f839067..4aaa9d1349c7c 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php @@ -35,9 +35,7 @@ class TemplateCacheCacheWarmer implements CacheWarmerInterface, ServiceSubscribe private $paths; /** - * @param ContainerInterface $container The dependency injection container - * @param TemplateFinderInterface|null $finder The template paths cache warmer - * @param array $paths Additional twig paths to warm + * @param array $paths Additional twig paths to warm */ public function __construct(ContainerInterface $container, TemplateFinderInterface $finder = null, array $paths = array()) { diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index f2db82b0995b0..57886da3b4693 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -48,10 +48,6 @@ public function __construct(Environment $twig, $debug) * the exception page (when true). If it is not present, the "debug" value passed into the constructor will * be used. * - * @param Request $request The request - * @param FlattenException $exception A FlattenException instance - * @param DebugLoggerInterface $logger A DebugLoggerInterface instance - * * @return Response * * @throws \InvalidArgumentException When the exception template does not exist diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index 667acfc350fbc..3fedcbddc03d6 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -43,7 +43,14 @@ public function process(ContainerBuilder $container) if ($container->has('form.extension')) { $container->getDefinition('twig.extension.form')->addTag('twig.extension'); $reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); - $container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())).'/Resources/views/Form')); + + $coreThemePath = dirname(dirname($reflClass->getFileName())).'/Resources/views/Form'; + $container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array($coreThemePath)); + + $paths = $container->getDefinition('twig.cache_warmer')->getArgument(2); + $paths[$coreThemePath] = null; + $container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths); + $container->getDefinition('twig.template_iterator')->replaceArgument(2, $paths); } if ($container->has('router')) { diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 8ea84e032e9b4..155707d011276 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -32,12 +32,6 @@ */ class TwigExtension extends Extension { - /** - * Responds to the twig configuration parameter. - * - * @param array $configs - * @param ContainerBuilder $container - */ public function load(array $configs, ContainerBuilder $container) { $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); @@ -106,6 +100,7 @@ public function load(array $configs, ContainerBuilder $container) } } + // paths are modified in ExtensionPass if forms are enabled $container->getDefinition('twig.cache_warmer')->replaceArgument(2, $config['paths']); $container->getDefinition('twig.template_iterator')->replaceArgument(2, $config['paths']); diff --git a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php index 5b34f7798647b..a938cb01d9e05 100644 --- a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php +++ b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php @@ -29,9 +29,7 @@ class FilesystemLoader extends BaseFilesystemLoader protected $parser; /** - * @param FileLocatorInterface $locator A FileLocatorInterface instance - * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance - * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) + * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) */ public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, $rootPath = null) { diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 6f53d3be00d70..00ed2f6ba597e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -174,8 +174,6 @@ public function toolbarAction(Request $request, $token) /** * Renders the profiler search bar. * - * @param Request $request The current HTTP Request - * * @return Response A Response instance * * @throws NotFoundHttpException @@ -280,8 +278,6 @@ public function searchResultsAction(Request $request, $token) /** * Narrows the search bar. * - * @param Request $request The current HTTP Request - * * @return Response A Response instance * * @throws NotFoundHttpException diff --git a/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php b/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php index 1862c2e498ddb..3bc642f428ffe 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php @@ -63,8 +63,6 @@ public function getName(Profile $profile, $panel) /** * Gets template names of templates that are present in the viewed profile. * - * @param Profile $profile - * * @return array * * @throws \UnexpectedValueException diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php index eed32c5a2055f..2a92d62eeea8d 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php @@ -29,6 +29,8 @@ class ServerLogCommand extends Command private $el; private $handler; + protected static $defaultName = 'server:log'; + public function isEnabled() { if (!class_exists(ConsoleFormatter::class)) { @@ -40,8 +42,6 @@ public function isEnabled() protected function configure() { - $this->setName('server:log'); - if (!class_exists(ConsoleFormatter::class)) { return; } diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php index b3139755b965e..7207a722ce2d0 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php @@ -32,6 +32,8 @@ class ServerRunCommand extends Command private $documentRoot; private $environment; + protected static $defaultName = 'server:run'; + public function __construct($documentRoot = null, $environment = null) { $this->documentRoot = $documentRoot; @@ -51,7 +53,6 @@ protected function configure() new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root, usually where your front controllers are stored'), new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'), )) - ->setName('server:run') ->setDescription('Runs a local web server') ->setHelp(<<<'EOF' %command.name% runs a local web server: By default, the server diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php index 1b1d3070e7fc8..b0d7886c4aa43 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php @@ -31,6 +31,8 @@ class ServerStartCommand extends Command private $documentRoot; private $environment; + protected static $defaultName = 'server:start'; + public function __construct($documentRoot = null, $environment = null) { $this->documentRoot = $documentRoot; @@ -45,7 +47,6 @@ public function __construct($documentRoot = null, $environment = null) protected function configure() { $this - ->setName('server:start') ->setDefinition(array( new InputArgument('addressport', InputArgument::OPTIONAL, 'The address to listen to (can be address:port, address, or port)'), new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root'), diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php index 7c9f6980e8bb5..8a9a1e92c525b 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php @@ -27,13 +27,14 @@ */ class ServerStatusCommand extends Command { + protected static $defaultName = 'server:status'; + /** * {@inheritdoc} */ protected function configure() { $this - ->setName('server:status') ->setDefinition(array( new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'), new InputOption('filter', null, InputOption::VALUE_REQUIRED, 'The value to display (one of port, host, or address)'), diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php index fc5e2fd563dfe..e63dce89d06d4 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php @@ -26,13 +26,14 @@ */ class ServerStopCommand extends Command { + protected static $defaultName = 'server:stop'; + /** * {@inheritdoc} */ protected function configure() { $this - ->setName('server:stop') ->setDefinition(array( new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'), )) diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml index 1aef987ceb6d5..21bbc969a53b2 100644 --- a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml +++ b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml @@ -26,5 +26,9 @@ + + + + diff --git a/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/WebServerExtensionTest.php b/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/WebServerExtensionTest.php new file mode 100644 index 0000000000000..17c41139fe649 --- /dev/null +++ b/src/Symfony/Bundle/WebServerBundle/Tests/DependencyInjection/WebServerExtensionTest.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebServerBundle\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Symfony\Bundle\WebServerBundle\DependencyInjection\WebServerExtension; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class WebServerExtensionTest extends TestCase +{ + public function testLoad() + { + $container = new ContainerBuilder(); + (new WebServerExtension())->load(array(), $container); + + $this->assertTrue($container->hasDefinition('web_server.command.server_run')); + $this->assertTrue($container->hasDefinition('web_server.command.server_start')); + $this->assertTrue($container->hasDefinition('web_server.command.server_stop')); + $this->assertTrue($container->hasDefinition('web_server.command.server_status')); + $this->assertTrue($container->hasDefinition('web_server.command.server_log')); + } +} diff --git a/src/Symfony/Bundle/WebServerBundle/composer.json b/src/Symfony/Bundle/WebServerBundle/composer.json index dda1c9245ffee..0bdddc495aa23 100644 --- a/src/Symfony/Bundle/WebServerBundle/composer.json +++ b/src/Symfony/Bundle/WebServerBundle/composer.json @@ -17,7 +17,9 @@ ], "require": { "php": "^7.1.3", + "symfony/config": "~3.4|~4.0", "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", "symfony/http-kernel": "~3.4|~4.0", "symfony/process": "~3.4|~4.0" }, @@ -27,9 +29,6 @@ "/Tests/" ] }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, "minimum-stability": "dev", "extra": { "branch-alias": { diff --git a/src/Symfony/Component/Asset/Packages.php b/src/Symfony/Component/Asset/Packages.php index 0a8c96354967c..63808d90786c0 100644 --- a/src/Symfony/Component/Asset/Packages.php +++ b/src/Symfony/Component/Asset/Packages.php @@ -38,11 +38,6 @@ public function __construct(PackageInterface $defaultPackage = null, array $pack } } - /** - * Sets the default package. - * - * @param PackageInterface $defaultPackage The default package - */ public function setDefaultPackage(PackageInterface $defaultPackage) { $this->defaultPackage = $defaultPackage; diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index ae14937a6df8a..23f7ccbff1f9c 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -233,8 +233,6 @@ public function getRequest() /** * Clicks on a given link. * - * @param Link $link A Link instance - * * @return Crawler */ public function click(Link $link) diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index c042c6a525295..4030ae4c62eef 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -21,8 +21,6 @@ class Cookie /** * Handles dates as defined by RFC 2616 section 3.3.1, and also some other * non-standard, but common formats. - * - * @var array */ private static $dateFormats = array( 'D, d M Y H:i:s T', diff --git a/src/Symfony/Component/BrowserKit/CookieJar.php b/src/Symfony/Component/BrowserKit/CookieJar.php index 4b9661b63fbd2..232cefc8b6647 100644 --- a/src/Symfony/Component/BrowserKit/CookieJar.php +++ b/src/Symfony/Component/BrowserKit/CookieJar.php @@ -20,11 +20,6 @@ class CookieJar { protected $cookieJar = array(); - /** - * Sets a cookie. - * - * @param Cookie $cookie A Cookie instance - */ public function set(Cookie $cookie) { $this->cookieJar[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; diff --git a/src/Symfony/Component/BrowserKit/History.php b/src/Symfony/Component/BrowserKit/History.php index 13af2b4f37927..aeca3277341c7 100644 --- a/src/Symfony/Component/BrowserKit/History.php +++ b/src/Symfony/Component/BrowserKit/History.php @@ -32,8 +32,6 @@ public function clear() /** * Adds a Request to the history. - * - * @param Request $request A Request instance */ public function add(Request $request) { diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php index ae9f6a7ae5c9c..9c9e122e86b71 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\BrowserKit\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\Cookie; +use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\Response; class CookieJarTest extends TestCase @@ -94,7 +94,7 @@ public function testUpdateFromSetCookieWithMultipleCookies() { $timestamp = time() + 3600; $date = gmdate('D, d M Y H:i:s \G\M\T', $timestamp); - $setCookies = array(sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%s', $date, $date)); + $setCookies = array(sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%1$s', $date)); $cookieJar = new CookieJar(); $cookieJar->updateFromSetCookie($setCookies); diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 727fc84c98473..758d3a8ec2e24 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -33,11 +33,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface private $createCacheItem; private $mergeByLifetime; - /** - * @param string $namespace - * @param int $defaultLifetime - */ - protected function __construct($namespace = '', $defaultLifetime = 0) + protected function __construct(string $namespace = '', int $defaultLifetime = 0) { $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':'; if (null !== $this->maxIdLength && strlen($namespace) > $this->maxIdLength - 24) { diff --git a/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php b/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php index 50554ed688309..7db3956588026 100644 --- a/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php @@ -18,13 +18,9 @@ class ApcuAdapter extends AbstractAdapter use ApcuTrait; /** - * @param string $namespace - * @param int $defaultLifetime - * @param string|null $version - * * @throws CacheException if APCu is not enabled */ - public function __construct($namespace = '', $defaultLifetime = 0, $version = null) + public function __construct(string $namespace = '', int $defaultLifetime = 0, string $version = null) { $this->init($namespace, $defaultLifetime, $version); } diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index 2118e9c6ffa57..fee7ed6d906d5 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -30,7 +30,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable * @param int $defaultLifetime * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise */ - public function __construct($defaultLifetime = 0, $storeSerialized = true) + public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true) { $this->storeSerialized = $storeSerialized; $this->createCacheItem = \Closure::bind( diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php index 6bdf6b2d54f14..910df0fd38ed5 100644 --- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php @@ -36,7 +36,7 @@ class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableIn * @param CacheItemPoolInterface[] $adapters The ordered list of adapters used to fetch cached items * @param int $maxLifetime The max lifetime of items propagated from lower adapters to upper ones */ - public function __construct(array $adapters, $maxLifetime = 0) + public function __construct(array $adapters, int $maxLifetime = 0) { if (!$adapters) { throw new InvalidArgumentException('At least one adapter must be specified.'); diff --git a/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php b/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php index 972d2b41545ef..75ae4cb7015c8 100644 --- a/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php @@ -18,12 +18,7 @@ class DoctrineAdapter extends AbstractAdapter { use DoctrineTrait; - /** - * @param CacheProvider $provider - * @param string $namespace - * @param int $defaultLifetime - */ - public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheProvider $provider, string $namespace = '', int $defaultLifetime = 0) { parent::__construct('', $defaultLifetime); $this->provider = $provider; diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php b/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php index d071964ec2c5c..a08888368347a 100644 --- a/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php @@ -18,12 +18,7 @@ class FilesystemAdapter extends AbstractAdapter implements PruneableInterface { use FilesystemTrait; - /** - * @param string $namespace - * @param int $defaultLifetime - * @param string|null $directory - */ - public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) + public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) { parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); diff --git a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php index 5637141a77a89..65ab9eda864bf 100644 --- a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php @@ -29,7 +29,7 @@ class MemcachedAdapter extends AbstractAdapter * * Using a MemcachedAdapter as a pure items store is fine. */ - public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0) + public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0) { $this->init($client, $namespace, $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php index 1be3809613ad0..7d83b0e53c843 100644 --- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php @@ -35,16 +35,13 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface * * db_password: The password when lazy-connect [default: ''] * * db_connection_options: An array of driver-specific connection options [default: array()] * - * @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null - * @param string $namespace - * @param int $defaultLifetime - * @param array $options An associative array of options + * @param \PDO|Connection|string $connOrDsn a \PDO or Connection instance or DSN string or null * * @throws InvalidArgumentException When first argument is not PDO nor Connection nor string * @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION * @throws InvalidArgumentException When namespace contains invalid characters */ - public function __construct($connOrDsn, $namespace = '', $defaultLifetime = 0, array $options = array()) + public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array()) { $this->init($connOrDsn, $namespace, $defaultLifetime, $options); } diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index a8f9ad77e6fd8..ab000e65dea66 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -36,7 +36,7 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl * @param string $file The PHP file were values are cached * @param AdapterInterface $fallbackPool A pool to fallback on when an item is not hit */ - public function __construct($file, AdapterInterface $fallbackPool) + public function __construct(string $file, AdapterInterface $fallbackPool) { $this->file = $file; $this->pool = $fallbackPool; diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php index 528d9c01fb304..41879df266571 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php @@ -20,13 +20,9 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface use PhpFilesTrait; /** - * @param string $namespace - * @param int $defaultLifetime - * @param string|null $directory - * * @throws CacheException if OPcache is not enabled */ - public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) + public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) { if (!static::isSupported()) { throw new CacheException('OPcache is not enabled'); diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php index 82c95c5b04582..da286dbf173f7 100644 --- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php @@ -30,12 +30,7 @@ class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableIn private $createCacheItem; private $poolHash; - /** - * @param CacheItemPoolInterface $pool - * @param string $namespace - * @param int $defaultLifetime - */ - public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0) { $this->pool = $pool; $this->poolHash = $poolHash = spl_object_hash($pool); diff --git a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php index c1e17997fb557..0bb76fcdd4ba6 100644 --- a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php @@ -22,7 +22,7 @@ class RedisAdapter extends AbstractAdapter * @param string $namespace The default namespace * @param int $defaultLifetime The default lifetime */ - public function __construct($redisClient, $namespace = '', $defaultLifetime = 0) + public function __construct($redisClient, string $namespace = '', int $defaultLifetime = 0) { $this->init($redisClient, $namespace, $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Adapter/SimpleCacheAdapter.php b/src/Symfony/Component/Cache/Adapter/SimpleCacheAdapter.php index 24db5d504ab68..2e6d03a1f0b41 100644 --- a/src/Symfony/Component/Cache/Adapter/SimpleCacheAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/SimpleCacheAdapter.php @@ -25,7 +25,7 @@ class SimpleCacheAdapter extends AbstractAdapter implements PruneableInterface, private $miss; - public function __construct(CacheInterface $pool, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheInterface $pool, string $namespace = '', int $defaultLifetime = 0) { parent::__construct($namespace, $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Simple/AbstractCache.php b/src/Symfony/Component/Cache/Simple/AbstractCache.php index e666effaf93f9..ae1e61ed86480 100644 --- a/src/Symfony/Component/Cache/Simple/AbstractCache.php +++ b/src/Symfony/Component/Cache/Simple/AbstractCache.php @@ -31,11 +31,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re private $defaultLifetime; - /** - * @param string $namespace - * @param int $defaultLifetime - */ - protected function __construct($namespace = '', $defaultLifetime = 0) + protected function __construct(string $namespace = '', int $defaultLifetime = 0) { $this->defaultLifetime = max(0, (int) $defaultLifetime); $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':'; diff --git a/src/Symfony/Component/Cache/Simple/ApcuCache.php b/src/Symfony/Component/Cache/Simple/ApcuCache.php index e583b44341dce..0877c394bbda3 100644 --- a/src/Symfony/Component/Cache/Simple/ApcuCache.php +++ b/src/Symfony/Component/Cache/Simple/ApcuCache.php @@ -17,12 +17,7 @@ class ApcuCache extends AbstractCache { use ApcuTrait; - /** - * @param string $namespace - * @param int $defaultLifetime - * @param string|null $version - */ - public function __construct($namespace = '', $defaultLifetime = 0, $version = null) + public function __construct(string $namespace = '', int $defaultLifetime = 0, string $version = null) { $this->init($namespace, $defaultLifetime, $version); } diff --git a/src/Symfony/Component/Cache/Simple/ArrayCache.php b/src/Symfony/Component/Cache/Simple/ArrayCache.php index 8d027cd2a3722..05640dfd17aa9 100644 --- a/src/Symfony/Component/Cache/Simple/ArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/ArrayCache.php @@ -34,7 +34,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte * @param int $defaultLifetime * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise */ - public function __construct($defaultLifetime = 0, $storeSerialized = true) + public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true) { $this->defaultLifetime = (int) $defaultLifetime; $this->storeSerialized = $storeSerialized; diff --git a/src/Symfony/Component/Cache/Simple/ChainCache.php b/src/Symfony/Component/Cache/Simple/ChainCache.php index 9d0c75870eb7e..05805b91e574a 100644 --- a/src/Symfony/Component/Cache/Simple/ChainCache.php +++ b/src/Symfony/Component/Cache/Simple/ChainCache.php @@ -35,7 +35,7 @@ class ChainCache implements CacheInterface, PruneableInterface, ResettableInterf * @param CacheInterface[] $caches The ordered list of caches used to fetch cached items * @param int $defaultLifetime The lifetime of items propagated from lower caches to upper ones */ - public function __construct(array $caches, $defaultLifetime = 0) + public function __construct(array $caches, int $defaultLifetime = 0) { if (!$caches) { throw new InvalidArgumentException('At least one cache must be specified.'); diff --git a/src/Symfony/Component/Cache/Simple/DoctrineCache.php b/src/Symfony/Component/Cache/Simple/DoctrineCache.php index 00f0b9c6fc326..0ba701d7cd9a6 100644 --- a/src/Symfony/Component/Cache/Simple/DoctrineCache.php +++ b/src/Symfony/Component/Cache/Simple/DoctrineCache.php @@ -18,12 +18,7 @@ class DoctrineCache extends AbstractCache { use DoctrineTrait; - /** - * @param CacheProvider $provider - * @param string $namespace - * @param int $defaultLifetime - */ - public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0) + public function __construct(CacheProvider $provider, string $namespace = '', int $defaultLifetime = 0) { parent::__construct('', $defaultLifetime); $this->provider = $provider; diff --git a/src/Symfony/Component/Cache/Simple/FilesystemCache.php b/src/Symfony/Component/Cache/Simple/FilesystemCache.php index ccd579534288e..37b3d3fa611b3 100644 --- a/src/Symfony/Component/Cache/Simple/FilesystemCache.php +++ b/src/Symfony/Component/Cache/Simple/FilesystemCache.php @@ -18,12 +18,7 @@ class FilesystemCache extends AbstractCache implements PruneableInterface { use FilesystemTrait; - /** - * @param string $namespace - * @param int $defaultLifetime - * @param string|null $directory - */ - public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) + public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) { parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); diff --git a/src/Symfony/Component/Cache/Simple/MemcachedCache.php b/src/Symfony/Component/Cache/Simple/MemcachedCache.php index 7717740622c5e..0ff521b9c31fb 100644 --- a/src/Symfony/Component/Cache/Simple/MemcachedCache.php +++ b/src/Symfony/Component/Cache/Simple/MemcachedCache.php @@ -19,12 +19,7 @@ class MemcachedCache extends AbstractCache protected $maxIdLength = 250; - /** - * @param \Memcached $client - * @param string $namespace - * @param int $defaultLifetime - */ - public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0) + public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0) { $this->init($client, $namespace, $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Simple/PdoCache.php b/src/Symfony/Component/Cache/Simple/PdoCache.php index 931a3b1ff7dba..65b9879cd37c4 100644 --- a/src/Symfony/Component/Cache/Simple/PdoCache.php +++ b/src/Symfony/Component/Cache/Simple/PdoCache.php @@ -35,16 +35,13 @@ class PdoCache extends AbstractCache implements PruneableInterface * * db_password: The password when lazy-connect [default: ''] * * db_connection_options: An array of driver-specific connection options [default: array()] * - * @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null - * @param string $namespace - * @param int $defaultLifetime - * @param array $options An associative array of options + * @param \PDO|Connection|string $connOrDsn a \PDO or Connection instance or DSN string or null * * @throws InvalidArgumentException When first argument is not PDO nor Connection nor string * @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION * @throws InvalidArgumentException When namespace contains invalid characters */ - public function __construct($connOrDsn, $namespace = '', $defaultLifetime = 0, array $options = array()) + public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array()) { $this->init($connOrDsn, $namespace, $defaultLifetime, $options); } diff --git a/src/Symfony/Component/Cache/Simple/PhpArrayCache.php b/src/Symfony/Component/Cache/Simple/PhpArrayCache.php index 314a0b435654c..0dba1f4895df7 100644 --- a/src/Symfony/Component/Cache/Simple/PhpArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/PhpArrayCache.php @@ -32,7 +32,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt * @param string $file The PHP file were values are cached * @param CacheInterface $fallbackPool A pool to fallback on when an item is not hit */ - public function __construct($file, CacheInterface $fallbackPool) + public function __construct(string $file, CacheInterface $fallbackPool) { $this->file = $file; $this->pool = $fallbackPool; diff --git a/src/Symfony/Component/Cache/Simple/PhpFilesCache.php b/src/Symfony/Component/Cache/Simple/PhpFilesCache.php index 9231c8cd39634..77239c32eda69 100644 --- a/src/Symfony/Component/Cache/Simple/PhpFilesCache.php +++ b/src/Symfony/Component/Cache/Simple/PhpFilesCache.php @@ -20,13 +20,9 @@ class PhpFilesCache extends AbstractCache implements PruneableInterface use PhpFilesTrait; /** - * @param string $namespace - * @param int $defaultLifetime - * @param string|null $directory - * * @throws CacheException if OPcache is not enabled */ - public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) + public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) { if (!static::isSupported()) { throw new CacheException('OPcache is not enabled'); diff --git a/src/Symfony/Component/Cache/Simple/RedisCache.php b/src/Symfony/Component/Cache/Simple/RedisCache.php index e82c0627e241d..45bb5ff799c8a 100644 --- a/src/Symfony/Component/Cache/Simple/RedisCache.php +++ b/src/Symfony/Component/Cache/Simple/RedisCache.php @@ -22,7 +22,7 @@ class RedisCache extends AbstractCache * @param string $namespace * @param int $defaultLifetime */ - public function __construct($redisClient, $namespace = '', $defaultLifetime = 0) + public function __construct($redisClient, string $namespace = '', int $defaultLifetime = 0) { $this->init($redisClient, $namespace, $defaultLifetime); } diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index ef068c9f34f78..6fb8a44be1bb2 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -198,8 +198,6 @@ public function getDefaultValue() /** * Adds a child node. * - * @param NodeInterface $node The child node to add - * * @throws \InvalidArgumentException when the child node has no name * @throws \InvalidArgumentException when the child node's name is not unique */ diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index 9bd95ec9f9d03..b8533b79e77a7 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -49,8 +49,6 @@ public function __construct($name, NodeParentInterface $parent = null) /** * Sets a custom children builder. - * - * @param NodeBuilder $builder A custom NodeBuilder */ public function setBuilder(NodeBuilder $builder) { @@ -378,8 +376,6 @@ public function normalizeKeys($bool) * ->append($this->getBarNodeDefinition()) * ; * - * @param NodeDefinition $node A NodeDefinition instance - * * @return $this */ public function append(NodeDefinition $node) @@ -477,8 +473,6 @@ protected function createNode() /** * Validate the configuration of a concrete node. * - * @param ArrayNode $node The related node - * * @throws InvalidDefinitionException */ protected function validateConcreteNode(ArrayNode $node) @@ -519,8 +513,6 @@ protected function validateConcreteNode(ArrayNode $node) /** * Validate the configuration of a prototype node. * - * @param PrototypedArrayNode $node The related node - * * @throws InvalidDefinitionException */ protected function validatePrototypeNode(PrototypedArrayNode $node) diff --git a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php index 56047ad5dec2c..817906f507629 100644 --- a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php @@ -23,8 +23,6 @@ class EnumNodeDefinition extends ScalarNodeDefinition private $values; /** - * @param array $values - * * @return $this */ public function values(array $values) diff --git a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php index 173b4c01fb5d3..3ea97802dcc58 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php @@ -25,9 +25,6 @@ class ExprBuilder public $ifPart; public $thenPart; - /** - * @param NodeDefinition $node The related node - */ public function __construct(NodeDefinition $node) { $this->node = $node; @@ -36,8 +33,6 @@ public function __construct(NodeDefinition $node) /** * Marks the expression as being always used. * - * @param \Closure $then - * * @return $this */ public function always(\Closure $then = null) @@ -56,8 +51,6 @@ public function always(\Closure $then = null) * * The default one tests if the value is true. * - * @param \Closure $closure - * * @return $this */ public function ifTrue(\Closure $closure = null) @@ -122,8 +115,6 @@ public function ifArray() /** * Tests if the value is in an array. * - * @param array $array - * * @return $this */ public function ifInArray(array $array) @@ -136,8 +127,6 @@ public function ifInArray(array $array) /** * Tests if the value is not in an array. * - * @param array $array - * * @return $this */ public function ifNotInArray(array $array) @@ -163,8 +152,6 @@ public function castToArray() /** * Sets the closure to run if the test pass. * - * @param \Closure $closure - * * @return $this */ public function then(\Closure $closure) diff --git a/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php index 09327a6db6768..105e2d64709b1 100644 --- a/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php @@ -22,9 +22,6 @@ class MergeBuilder public $allowFalse = false; public $allowOverwrite = true; - /** - * @param NodeDefinition $node The related node - */ public function __construct(NodeDefinition $node) { $this->node = $node; diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php index d795f8ff84865..9b325f189b841 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php @@ -37,8 +37,6 @@ public function __construct() /** * Set the parent node. * - * @param ParentNodeDefinitionInterface $parent The parent node - * * @return $this */ public function setParent(ParentNodeDefinitionInterface $parent = null) @@ -177,8 +175,6 @@ public function node($name, $type) * ->end() * ; * - * @param NodeDefinition $node - * * @return $this */ public function append(NodeDefinition $node) diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php index 8b9328105b34b..4539b316bf96e 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -33,10 +33,6 @@ abstract class NodeDefinition implements NodeParentInterface protected $nullEquivalent; protected $trueEquivalent = true; protected $falseEquivalent = false; - - /** - * @var NodeParentInterface|null - */ protected $parent; protected $attributes = array(); @@ -53,8 +49,6 @@ public function __construct($name, NodeParentInterface $parent = null) /** * Sets the parent node. * - * @param NodeParentInterface $parent The parent - * * @return $this */ public function setParent(NodeParentInterface $parent) diff --git a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php index 8ff1d8a045103..35e30487a60eb 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php @@ -22,9 +22,6 @@ class NormalizationBuilder public $before = array(); public $remappings = array(); - /** - * @param NodeDefinition $node The related node - */ public function __construct(NodeDefinition $node) { $this->node = $node; @@ -48,8 +45,6 @@ public function remap($key, $plural = null) /** * Registers a closure to run before the normalization or an expression builder to build it if null is provided. * - * @param \Closure $closure - * * @return ExprBuilder|$this */ public function before(\Closure $closure = null) diff --git a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php index 5d02848a09003..ccaa3ee90b06f 100644 --- a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php @@ -22,7 +22,6 @@ class TreeBuilder implements NodeParentInterface { protected $tree; protected $root; - protected $builder; /** * Creates the root node. diff --git a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php index 0acd7343910e3..bb2b9eb33924b 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php @@ -21,9 +21,6 @@ class ValidationBuilder protected $node; public $rules = array(); - /** - * @param NodeDefinition $node The related node - */ public function __construct(NodeDefinition $node) { $this->node = $node; @@ -32,8 +29,6 @@ public function __construct(NodeDefinition $node) /** * Registers a closure to run as normalization or an expression builder to build it if null is provided. * - * @param \Closure $closure - * * @return ExprBuilder|$this */ public function rule(\Closure $closure = null) diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index 1c3c2188326be..08f335a015f30 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -150,8 +150,6 @@ public function getDefaultValue() /** * Sets the node prototype. - * - * @param PrototypeNodeInterface $node */ public function setPrototype(PrototypeNodeInterface $node) { @@ -171,8 +169,6 @@ public function getPrototype() /** * Disable adding concrete children for prototyped nodes. * - * @param NodeInterface $node The child node to add - * * @throws Exception */ public function addChild(NodeInterface $node) diff --git a/src/Symfony/Component/Config/Exception/FileLoaderLoadException.php b/src/Symfony/Component/Config/Exception/FileLoaderLoadException.php index 564f75ce60b8c..a19069a6aeb0e 100644 --- a/src/Symfony/Component/Config/Exception/FileLoaderLoadException.php +++ b/src/Symfony/Component/Config/Exception/FileLoaderLoadException.php @@ -64,7 +64,7 @@ public function __construct($resource, $sourceResource = null, $code = null, $pr } elseif (null !== $type) { // maybe there is no loader for this specific type if ('annotation' === $type) { - $message .= ' Make sure annotations are enabled.'; + $message .= ' Make sure annotations are installed and enabled.'; } else { $message .= sprintf(' Make sure there is a loader supporting the "%s" type.', $type); } diff --git a/src/Symfony/Component/Config/Loader/DelegatingLoader.php b/src/Symfony/Component/Config/Loader/DelegatingLoader.php index 028e4ac449df3..452e81c58bf01 100644 --- a/src/Symfony/Component/Config/Loader/DelegatingLoader.php +++ b/src/Symfony/Component/Config/Loader/DelegatingLoader.php @@ -23,9 +23,6 @@ */ class DelegatingLoader extends Loader { - /** - * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance - */ public function __construct(LoaderResolverInterface $resolver) { $this->resolver = $resolver; diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index cf2aeb6c3026c..136d2d42dc396 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -25,21 +25,12 @@ */ abstract class FileLoader extends Loader { - /** - * @var array - */ protected static $loading = array(); - /** - * @var FileLocatorInterface - */ protected $locator; private $currentDir; - /** - * @param FileLocatorInterface $locator A FileLocatorInterface instance - */ public function __construct(FileLocatorInterface $locator) { $this->locator = $locator; diff --git a/src/Symfony/Component/Config/Loader/LoaderInterface.php b/src/Symfony/Component/Config/Loader/LoaderInterface.php index dd0a85a6b08c7..dfca9dd27bf0d 100644 --- a/src/Symfony/Component/Config/Loader/LoaderInterface.php +++ b/src/Symfony/Component/Config/Loader/LoaderInterface.php @@ -47,8 +47,6 @@ public function getResolver(); /** * Sets the loader resolver. - * - * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance */ public function setResolver(LoaderResolverInterface $resolver); } diff --git a/src/Symfony/Component/Config/Loader/LoaderResolver.php b/src/Symfony/Component/Config/Loader/LoaderResolver.php index 288feb865bd1b..9299bc000f5f4 100644 --- a/src/Symfony/Component/Config/Loader/LoaderResolver.php +++ b/src/Symfony/Component/Config/Loader/LoaderResolver.php @@ -50,11 +50,6 @@ public function resolve($resource, $type = null) return false; } - /** - * Adds a loader. - * - * @param LoaderInterface $loader A LoaderInterface instance - */ public function addLoader(LoaderInterface $loader) { $this->loaders[] = $loader; diff --git a/src/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php b/src/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php index 7c5e167c44086..8363084c19a22 100644 --- a/src/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php +++ b/src/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php @@ -31,7 +31,7 @@ public function testMessageCannotLoadResourceWithType() public function testMessageCannotLoadResourceWithAnnotationType() { $exception = new FileLoaderLoadException('resource', null, null, null, 'annotation'); - $this->assertEquals('Cannot load resource "resource". Make sure annotations are enabled.', $exception->getMessage()); + $this->assertEquals('Cannot load resource "resource". Make sure annotations are installed and enabled.', $exception->getMessage()); } public function testMessageCannotImportResourceFromSource() diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 187982adf0a9d..bca5883baeac5 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -100,9 +100,6 @@ public function setCommandLoader(CommandLoaderInterface $commandLoader) /** * Runs the current application. * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * * @return int 0 if everything went fine, or an error code * * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}. @@ -167,9 +164,6 @@ public function run(InputInterface $input = null, OutputInterface $output = null /** * Runs the current application. * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * * @return int 0 if everything went fine, or an error code */ public function doRun(InputInterface $input, OutputInterface $output) @@ -226,11 +220,6 @@ public function doRun(InputInterface $input, OutputInterface $output) return $exitCode; } - /** - * Set a helper set to be used with the command. - * - * @param HelperSet $helperSet The helper set - */ public function setHelperSet(HelperSet $helperSet) { $this->helperSet = $helperSet; @@ -250,11 +239,6 @@ public function getHelperSet() return $this->helperSet; } - /** - * Set an input definition to be used with this application. - * - * @param InputDefinition $definition The input definition - */ public function setDefinition(InputDefinition $definition) { $this->definition = $definition; @@ -421,8 +405,6 @@ public function addCommands(array $commands) * If a command with the same name already exists, it will be overridden. * If the command is not enabled it will not be added. * - * @param Command $command A Command object - * * @return Command|null The registered command if enabled or null */ public function add(Command $command) @@ -709,9 +691,6 @@ public static function getAbbreviations($names) /** * Renders a caught exception. - * - * @param \Exception $e An exception instance - * @param OutputInterface $output An OutputInterface instance */ public function renderException(\Exception $e, OutputInterface $output) { @@ -787,9 +766,6 @@ protected function doRenderException(\Exception $e, OutputInterface $output) /** * Configures the input and output instances based on the user arguments and options. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance */ protected function configureIO(InputInterface $input, OutputInterface $output) { @@ -852,10 +828,6 @@ protected function configureIO(InputInterface $input, OutputInterface $output) * If an event dispatcher has been attached to the application, * events are also dispatched during the life-cycle of the command. * - * @param Command $command A Command instance - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * * @return int 0 if everything went fine, or an error code */ protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) @@ -908,8 +880,6 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI /** * Gets the name of the command based on input. * - * @param InputInterface $input The input interface - * * @return string The command name */ protected function getCommandName(InputInterface $input) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 102b5cd29a656..fec96dba2c5bc 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -87,11 +87,6 @@ public function ignoreValidationErrors() $this->ignoreValidationErrors = true; } - /** - * Sets the application instance for this command. - * - * @param Application $application An Application instance - */ public function setApplication(Application $application = null) { $this->application = $application; @@ -102,11 +97,6 @@ public function setApplication(Application $application = null) } } - /** - * Sets the helper set. - * - * @param HelperSet $helperSet A HelperSet instance - */ public function setHelperSet(HelperSet $helperSet) { $this->helperSet = $helperSet; @@ -160,9 +150,6 @@ protected function configure() * execute() method, you set the code to execute by passing * a Closure to the setCode() method. * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * * @return null|int null or 0 if everything went fine, or an error code * * @throws LogicException When this abstract method is not implemented @@ -180,9 +167,6 @@ protected function execute(InputInterface $input, OutputInterface $output) * This method is executed before the InputDefinition is validated. * This means that this is the only place where the command can * interactively ask for values of missing required arguments. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance */ protected function interact(InputInterface $input, OutputInterface $output) { @@ -193,9 +177,6 @@ protected function interact(InputInterface $input, OutputInterface $output) * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance */ protected function initialize(InputInterface $input, OutputInterface $output) { @@ -208,9 +189,6 @@ protected function initialize(InputInterface $input, OutputInterface $output) * setCode() method or by overriding the execute() method * in a sub-class. * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * * @return int The command exit code * * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. diff --git a/src/Symfony/Component/Console/Command/HelpCommand.php b/src/Symfony/Component/Console/Command/HelpCommand.php index b8fd911ad4082..112679b34a804 100644 --- a/src/Symfony/Component/Console/Command/HelpCommand.php +++ b/src/Symfony/Component/Console/Command/HelpCommand.php @@ -56,11 +56,6 @@ protected function configure() ; } - /** - * Sets the command. - * - * @param Command $command The command to set - */ public function setCommand(Command $command) { $this->command = $command; diff --git a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php index c9525e27225a7..ef4c673b7bcf3 100644 --- a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php +++ b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php @@ -24,15 +24,9 @@ class ApplicationDescription { const GLOBAL_NAMESPACE = '_global'; - /** - * @var Application - */ private $application; - - /** - * @var null|string - */ private $namespace; + private $showHidden; /** * @var array @@ -49,11 +43,6 @@ class ApplicationDescription */ private $aliases; - /** - * @var bool - */ - private $showHidden; - /** * @param Application $application * @param string|null $namespace @@ -135,8 +124,6 @@ private function inspectApplication() } /** - * @param array $commands - * * @return array */ private function sortCommands(array $commands) diff --git a/src/Symfony/Component/Console/Descriptor/Descriptor.php b/src/Symfony/Component/Console/Descriptor/Descriptor.php index 50dd86ce23f85..fe169cb48a35c 100644 --- a/src/Symfony/Component/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Component/Console/Descriptor/Descriptor.php @@ -73,9 +73,6 @@ protected function write($content, $decorated = false) /** * Describes an InputArgument instance. * - * @param InputArgument $argument - * @param array $options - * * @return string|mixed */ abstract protected function describeInputArgument(InputArgument $argument, array $options = array()); @@ -83,9 +80,6 @@ abstract protected function describeInputArgument(InputArgument $argument, array /** * Describes an InputOption instance. * - * @param InputOption $option - * @param array $options - * * @return string|mixed */ abstract protected function describeInputOption(InputOption $option, array $options = array()); @@ -93,9 +87,6 @@ abstract protected function describeInputOption(InputOption $option, array $opti /** * Describes an InputDefinition instance. * - * @param InputDefinition $definition - * @param array $options - * * @return string|mixed */ abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array()); @@ -103,9 +94,6 @@ abstract protected function describeInputDefinition(InputDefinition $definition, /** * Describes a Command instance. * - * @param Command $command - * @param array $options - * * @return string|mixed */ abstract protected function describeCommand(Command $command, array $options = array()); @@ -113,9 +101,6 @@ abstract protected function describeCommand(Command $command, array $options = a /** * Describes an Application instance. * - * @param Application $application - * @param array $options - * * @return string|mixed */ abstract protected function describeApplication(Application $application, array $options = array()); diff --git a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php index 453577cd67907..35c87c2207da6 100644 --- a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php @@ -93,9 +93,6 @@ protected function describeApplication(Application $application, array $options /** * Writes data as json. * - * @param array $data - * @param array $options - * * @return array|string */ private function writeData(array $data, array $options) @@ -104,8 +101,6 @@ private function writeData(array $data, array $options) } /** - * @param InputArgument $argument - * * @return array */ private function getInputArgumentData(InputArgument $argument) @@ -120,8 +115,6 @@ private function getInputArgumentData(InputArgument $argument) } /** - * @param InputOption $option - * * @return array */ private function getInputOptionData(InputOption $option) @@ -138,8 +131,6 @@ private function getInputOptionData(InputOption $option) } /** - * @param InputDefinition $definition - * * @return array */ private function getInputDefinitionData(InputDefinition $definition) @@ -158,8 +149,6 @@ private function getInputDefinitionData(InputDefinition $definition) } /** - * @param Command $command - * * @return array */ private function getCommandData(Command $command) diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php index ffcc224a304f3..82f7eb9d4c909 100644 --- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php @@ -323,7 +323,7 @@ private function getColumnWidth(array $commands) * * @return int */ - private function calculateTotalWidthForOptions($options) + private function calculateTotalWidthForOptions(array $options) { $totalWidth = 0; foreach ($options as $option) { diff --git a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php index bc7f2e1e433e5..f05756ca309da 100644 --- a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php @@ -27,8 +27,6 @@ class XmlDescriptor extends Descriptor { /** - * @param InputDefinition $definition - * * @return \DOMDocument */ public function getInputDefinitionDocument(InputDefinition $definition) @@ -50,8 +48,6 @@ public function getInputDefinitionDocument(InputDefinition $definition) } /** - * @param Command $command - * * @return \DOMDocument */ public function getCommandDocument(Command $command) @@ -173,9 +169,6 @@ protected function describeApplication(Application $application, array $options /** * Appends document children to parent node. - * - * @param \DOMNode $parentNode - * @param \DOMNode $importedParent */ private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) { @@ -187,8 +180,6 @@ private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) /** * Writes DOM document. * - * @param \DOMDocument $dom - * * @return \DOMDocument|string */ private function writeDocument(\DOMDocument $dom) @@ -198,8 +189,6 @@ private function writeDocument(\DOMDocument $dom) } /** - * @param InputArgument $argument - * * @return \DOMDocument */ private function getInputArgumentDocument(InputArgument $argument) @@ -224,8 +213,6 @@ private function getInputArgumentDocument(InputArgument $argument) } /** - * @param InputOption $option - * * @return \DOMDocument */ private function getInputOptionDocument(InputOption $option) diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index c7c6b4a019198..7ada54f4c11b9 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -172,9 +172,7 @@ public function unsetOption($option) } /** - * Sets multiple style options at once. - * - * @param array $options + * {@inheritdoc} */ public function setOptions(array $options) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index c36fda80708d0..4c7dc4134d723 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -48,8 +48,6 @@ public function unsetOption($option); /** * Sets multiple style options at once. - * - * @param array $options */ public function setOptions(array $options); diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php index 7301d1002b86b..bf0beb709ed1c 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php @@ -23,14 +23,8 @@ class OutputFormatterStyleStack */ private $styles; - /** - * @var OutputFormatterStyleInterface - */ private $emptyStyle; - /** - * @param OutputFormatterStyleInterface|null $emptyStyle - */ public function __construct(OutputFormatterStyleInterface $emptyStyle = null) { $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle(); @@ -47,8 +41,6 @@ public function reset() /** * Pushes a style in the stack. - * - * @param OutputFormatterStyleInterface $style */ public function push(OutputFormatterStyleInterface $style) { @@ -58,8 +50,6 @@ public function push(OutputFormatterStyleInterface $style) /** * Pops a style from the stack. * - * @param OutputFormatterStyleInterface|null $style - * * @return OutputFormatterStyleInterface * * @throws InvalidArgumentException When style tags incorrectly nested @@ -100,8 +90,6 @@ public function getCurrent() } /** - * @param OutputFormatterStyleInterface $emptyStyle - * * @return $this */ public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle) diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php index 44bc2da239997..0954bad6b2df7 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -23,9 +23,7 @@ abstract class Helper implements HelperInterface protected $helperSet = null; /** - * Sets the helper set associated with this helper. - * - * @param HelperSet $helperSet A HelperSet instance + * {@inheritdoc} */ public function setHelperSet(HelperSet $helperSet = null) { @@ -33,9 +31,7 @@ public function setHelperSet(HelperSet $helperSet = null) } /** - * Gets the helper set associated with this helper. - * - * @return HelperSet|null + * {@inheritdoc} */ public function getHelperSet() { diff --git a/src/Symfony/Component/Console/Helper/HelperInterface.php b/src/Symfony/Component/Console/Helper/HelperInterface.php index 5a923e0a88cb9..1ce823587e4a7 100644 --- a/src/Symfony/Component/Console/Helper/HelperInterface.php +++ b/src/Symfony/Component/Console/Helper/HelperInterface.php @@ -20,8 +20,6 @@ interface HelperInterface { /** * Sets the helper set associated with this helper. - * - * @param HelperSet $helperSet A HelperSet instance */ public function setHelperSet(HelperSet $helperSet = null); diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index 5331e844a27bc..24ce18fb49c94 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -83,11 +83,6 @@ public function get($name) return $this->helpers[$name]; } - /** - * Sets the command associated with this helper set. - * - * @param Command $command A Command instance - */ public function setCommand(Command $command = null) { $this->command = $command; diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index f0c62c48c1741..c4201932d5c9e 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -12,11 +12,12 @@ namespace Symfony\Component\Console\Helper; use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\ChoiceQuestion; @@ -34,10 +35,6 @@ class QuestionHelper extends Helper /** * Asks a question to the user. * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * @param Question $question The question to ask - * * @return mixed The user answer * * @throws RuntimeException If there is no data to read in the input stream @@ -86,9 +83,6 @@ public static function disableStty() /** * Asks the question to the user. * - * @param OutputInterface $output - * @param Question $question - * * @return bool|mixed|null|string * * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden @@ -134,9 +128,6 @@ private function doAsk(OutputInterface $output, Question $question) /** * Outputs the question prompt. - * - * @param OutputInterface $output - * @param Question $question */ protected function writePrompt(OutputInterface $output, Question $question) { @@ -161,9 +152,6 @@ protected function writePrompt(OutputInterface $output, Question $question) /** * Outputs an error message. - * - * @param OutputInterface $output - * @param \Exception $error */ protected function writeError(OutputInterface $output, \Exception $error) { @@ -283,7 +271,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu // Save cursor position $output->write("\0337"); // Write highlighted text - $output->write(''.substr($matches[$ofs], $i).''); + $output->write(''.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).''); // Restore cursor position $output->write("\0338"); } diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 574e9b46e4a24..678d3cc0cc3e5 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -26,29 +26,23 @@ class Table { /** * Table headers. - * - * @var array */ private $headers = array(); /** * Table rows. - * - * @var array */ private $rows = array(); /** * Column widths cache. - * - * @var array */ private $effectiveColumnWidths = array(); /** * Number of columns cache. * - * @var array + * @var int */ private $numberOfColumns; @@ -459,7 +453,7 @@ private function buildTableRows($rows) * * @return array */ - private function fillNextRows($rows, $line) + private function fillNextRows(array $rows, $line) { $unmergedRows = array(); foreach ($rows[$line] as $column => $cell) { @@ -510,7 +504,7 @@ private function fillNextRows($rows, $line) /** * fill cells for a row that contains colspan > 1. * - * @param array $row + * @param array|\Traversable $row * * @return array */ @@ -536,7 +530,7 @@ private function fillCells($row) * * @return array */ - private function copyRow($rows, $line) + private function copyRow(array $rows, $line) { $row = $rows[$line]; foreach ($row as $cellKey => $cellValue) { @@ -552,8 +546,6 @@ private function copyRow($rows, $line) /** * Gets number of columns by row. * - * @param array $row - * * @return int */ private function getNumberOfColumns(array $row) @@ -569,11 +561,9 @@ private function getNumberOfColumns(array $row) /** * Gets list of columns for the given row. * - * @param array $row - * * @return array */ - private function getRowColumns($row) + private function getRowColumns(array $row) { $columns = range(0, $this->numberOfColumns - 1); foreach ($row as $cellKey => $cell) { diff --git a/src/Symfony/Component/Console/Helper/TableCell.php b/src/Symfony/Component/Console/Helper/TableCell.php index a3064fc0981f6..6fc7d3b913b62 100644 --- a/src/Symfony/Component/Console/Helper/TableCell.php +++ b/src/Symfony/Component/Console/Helper/TableCell.php @@ -18,14 +18,7 @@ */ class TableCell { - /** - * @var string - */ private $value; - - /** - * @var array - */ private $options = array( 'rowspan' => 1, 'colspan' => 1, diff --git a/src/Symfony/Component/Console/Helper/TableSeparator.php b/src/Symfony/Component/Console/Helper/TableSeparator.php index 8cc73e69a25f4..c7b8dc9c22339 100644 --- a/src/Symfony/Component/Console/Helper/TableSeparator.php +++ b/src/Symfony/Component/Console/Helper/TableSeparator.php @@ -18,9 +18,6 @@ */ class TableSeparator extends TableCell { - /** - * @param array $options - */ public function __construct(array $options = array()) { parent::__construct('', $options); diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php index e3845c0640c0f..e6c28de978cb1 100644 --- a/src/Symfony/Component/Console/Input/ArrayInput.php +++ b/src/Symfony/Component/Console/Input/ArrayInput.php @@ -27,10 +27,6 @@ class ArrayInput extends Input { private $parameters; - /** - * @param array $parameters An array of parameters - * @param InputDefinition|null $definition A InputDefinition instance - */ public function __construct(array $parameters, InputDefinition $definition = null) { $this->parameters = $parameters; diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php index d75d4748d41c1..41413252194f5 100644 --- a/src/Symfony/Component/Console/Input/Input.php +++ b/src/Symfony/Component/Console/Input/Input.php @@ -27,18 +27,12 @@ */ abstract class Input implements InputInterface, StreamableInputInterface { - /** - * @var InputDefinition - */ protected $definition; protected $stream; protected $options = array(); protected $arguments = array(); protected $interactive = true; - /** - * @param InputDefinition|null $definition A InputDefinition instance - */ public function __construct(InputDefinition $definition = null) { if (null === $definition) { diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index 2f4b365e41b24..2e0c9a148e020 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -45,8 +45,6 @@ public function __construct(array $definition = array()) /** * Sets the definition of the input. - * - * @param array $definition The definition array */ public function setDefinition(array $definition) { @@ -93,10 +91,6 @@ public function addArguments($arguments = array()) } /** - * Adds an InputArgument object. - * - * @param InputArgument $argument An InputArgument object - * * @throws LogicException When incorrect argument is given */ public function addArgument(InputArgument $argument) @@ -230,10 +224,6 @@ public function addOptions($options = array()) } /** - * Adds an InputOption object. - * - * @param InputOption $option An InputOption object - * * @throws LogicException When option given already exist */ public function addOption(InputOption $option) diff --git a/src/Symfony/Component/Console/Input/InputInterface.php b/src/Symfony/Component/Console/Input/InputInterface.php index bc66466437fe2..e2412d71f1714 100644 --- a/src/Symfony/Component/Console/Input/InputInterface.php +++ b/src/Symfony/Component/Console/Input/InputInterface.php @@ -57,8 +57,6 @@ public function getParameterOption($values, $default = false, $onlyParams = fals /** * Binds the current Input instance with the given arguments and options. - * - * @param InputDefinition $definition A InputDefinition instance */ public function bind(InputDefinition $definition); diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index 8f694bc7623b2..3af8077c94b81 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -193,8 +193,6 @@ public function getDescription() /** * Checks whether the given option equals this one. * - * @param InputOption $option option to compare - * * @return bool */ public function equals(InputOption $option) diff --git a/src/Symfony/Component/Console/Logger/ConsoleLogger.php b/src/Symfony/Component/Console/Logger/ConsoleLogger.php index ee2e1857545d6..05dd3b966ee62 100644 --- a/src/Symfony/Component/Console/Logger/ConsoleLogger.php +++ b/src/Symfony/Component/Console/Logger/ConsoleLogger.php @@ -29,13 +29,7 @@ class ConsoleLogger extends AbstractLogger const INFO = 'info'; const ERROR = 'error'; - /** - * @var OutputInterface - */ private $output; - /** - * @var array - */ private $verbosityLevelMap = array( LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, @@ -46,9 +40,6 @@ class ConsoleLogger extends AbstractLogger LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE, LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG, ); - /** - * @var array - */ private $formatLevelMap = array( LogLevel::EMERGENCY => self::ERROR, LogLevel::ALERT => self::ERROR, @@ -61,11 +52,6 @@ class ConsoleLogger extends AbstractLogger ); private $errored = false; - /** - * @param OutputInterface $output - * @param array $verbosityLevelMap - * @param array $formatLevelMap - */ public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array()) { $this->output = $output; diff --git a/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php b/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php index 5eb4fc7acde2b..b44ea7e058de6 100644 --- a/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php +++ b/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php @@ -26,10 +26,5 @@ interface ConsoleOutputInterface extends OutputInterface */ public function getErrorOutput(); - /** - * Sets the OutputInterface used for errors. - * - * @param OutputInterface $error - */ public function setErrorOutput(OutputInterface $error); } diff --git a/src/Symfony/Component/Console/Output/OutputInterface.php b/src/Symfony/Component/Console/Output/OutputInterface.php index a291ca7d7e220..cddfbb49e075f 100644 --- a/src/Symfony/Component/Console/Output/OutputInterface.php +++ b/src/Symfony/Component/Console/Output/OutputInterface.php @@ -103,11 +103,6 @@ public function setDecorated($decorated); */ public function isDecorated(); - /** - * Sets output formatter. - * - * @param OutputFormatterInterface $formatter - */ public function setFormatter(OutputFormatterInterface $formatter); /** diff --git a/src/Symfony/Component/Console/Style/OutputStyle.php b/src/Symfony/Component/Console/Style/OutputStyle.php index 1274a98d13b6b..ad8864110e459 100644 --- a/src/Symfony/Component/Console/Style/OutputStyle.php +++ b/src/Symfony/Component/Console/Style/OutputStyle.php @@ -25,9 +25,6 @@ abstract class OutputStyle implements OutputInterface, StyleInterface { private $output; - /** - * @param OutputInterface $output - */ public function __construct(OutputInterface $output) { $this->output = $output; diff --git a/src/Symfony/Component/Console/Style/StyleInterface.php b/src/Symfony/Component/Console/Style/StyleInterface.php index 2448547f855aa..a9205e5a70623 100644 --- a/src/Symfony/Component/Console/Style/StyleInterface.php +++ b/src/Symfony/Component/Console/Style/StyleInterface.php @@ -34,8 +34,6 @@ public function section($message); /** * Formats a list. - * - * @param array $elements */ public function listing(array $elements); @@ -83,9 +81,6 @@ public function caution($message); /** * Formats a table. - * - * @param array $headers - * @param array $rows */ public function table(array $headers, array $rows); diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index c15ae4660001f..969b0196dd071 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -40,10 +40,6 @@ class SymfonyStyle extends OutputStyle private $lineLength; private $bufferedOutput; - /** - * @param InputInterface $input - * @param OutputInterface $output - */ public function __construct(InputInterface $input, OutputInterface $output) { $this->input = $input; @@ -283,8 +279,6 @@ public function createProgressBar($max = 0) } /** - * @param Question $question - * * @return string */ public function askQuestion(Question $question) diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index eb95e4a3461cd..5f8b8b2a603ed 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -31,9 +31,6 @@ class CommandTester private $inputs = array(); private $statusCode; - /** - * @param Command $command A Command instance to test - */ public function __construct(Command $command) { $this->command = $command; diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index e0aab1b9b4de2..6744bc257bc14 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -153,6 +153,45 @@ public function testAskWithAutocompleteWithNonSequentialKeys() $this->assertEquals('AsseticBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); } + public function testAutocompleteWithTrailingBackslash() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + $inputStream = $this->getInputStream('E'); + + $dialog = new QuestionHelper(); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new Question(''); + $expectedCompletion = 'ExampleNamespace\\'; + $question->setAutocompleterValues(array($expectedCompletion)); + + $output = $this->createOutputInterface(); + $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $output, $question); + + $outputStream = $output->getStream(); + rewind($outputStream); + $actualOutput = stream_get_contents($outputStream); + + // Shell control (esc) sequences are not so important: we only care that + // tag is interpreted correctly and replaced + $irrelevantEscSequences = array( + "\0337" => '', // Save cursor position + "\0338" => '', // Restore cursor position + "\033[K" => '', // Clear line from cursor till the end + ); + + $importantActualOutput = strtr($actualOutput, $irrelevantEscSequences); + + // Remove colors (e.g. "\033[30m", "\033[31;41m") + $importantActualOutput = preg_replace('/\033\[\d+(;\d+)?m/', '', $importantActualOutput); + + $this->assertEquals($expectedCompletion, $importantActualOutput); + } + public function testAskHiddenResponse() { if ('\\' === DIRECTORY_SEPARATOR) { diff --git a/src/Symfony/Component/CssSelector/Node/AttributeNode.php b/src/Symfony/Component/CssSelector/Node/AttributeNode.php index 0db22c009589b..2c1005b7c3967 100644 --- a/src/Symfony/Component/CssSelector/Node/AttributeNode.php +++ b/src/Symfony/Component/CssSelector/Node/AttributeNode.php @@ -23,29 +23,10 @@ */ class AttributeNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var string - */ private $namespace; - - /** - * @var string - */ private $attribute; - - /** - * @var string - */ private $operator; - - /** - * @var string - */ private $value; /** diff --git a/src/Symfony/Component/CssSelector/Node/ClassNode.php b/src/Symfony/Component/CssSelector/Node/ClassNode.php index f036c41c157be..1c5d6f1a00e07 100644 --- a/src/Symfony/Component/CssSelector/Node/ClassNode.php +++ b/src/Symfony/Component/CssSelector/Node/ClassNode.php @@ -23,14 +23,7 @@ */ class ClassNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var string - */ private $name; /** diff --git a/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php b/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php index 97a122cb2ae82..d55b5306feff4 100644 --- a/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php +++ b/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php @@ -23,19 +23,8 @@ */ class CombinedSelectorNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var string - */ private $combinator; - - /** - * @var NodeInterface - */ private $subSelector; /** diff --git a/src/Symfony/Component/CssSelector/Node/FunctionNode.php b/src/Symfony/Component/CssSelector/Node/FunctionNode.php index ba2434c062816..72e4a02d7fceb 100644 --- a/src/Symfony/Component/CssSelector/Node/FunctionNode.php +++ b/src/Symfony/Component/CssSelector/Node/FunctionNode.php @@ -25,19 +25,8 @@ */ class FunctionNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var string - */ private $name; - - /** - * @var Token[] - */ private $arguments; /** diff --git a/src/Symfony/Component/CssSelector/Node/HashNode.php b/src/Symfony/Component/CssSelector/Node/HashNode.php index 50e6d09ff7def..6c72012626703 100644 --- a/src/Symfony/Component/CssSelector/Node/HashNode.php +++ b/src/Symfony/Component/CssSelector/Node/HashNode.php @@ -23,14 +23,7 @@ */ class HashNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var string - */ private $id; /** diff --git a/src/Symfony/Component/CssSelector/Node/NegationNode.php b/src/Symfony/Component/CssSelector/Node/NegationNode.php index e481b52861a57..9d3e9bc7a6e0c 100644 --- a/src/Symfony/Component/CssSelector/Node/NegationNode.php +++ b/src/Symfony/Component/CssSelector/Node/NegationNode.php @@ -23,20 +23,9 @@ */ class NegationNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var NodeInterface - */ private $subSelector; - /** - * @param NodeInterface $selector - * @param NodeInterface $subSelector - */ public function __construct(NodeInterface $selector, NodeInterface $subSelector) { $this->selector = $selector; diff --git a/src/Symfony/Component/CssSelector/Node/PseudoNode.php b/src/Symfony/Component/CssSelector/Node/PseudoNode.php index 25aa9e2b2799f..afc32f82c3d6d 100644 --- a/src/Symfony/Component/CssSelector/Node/PseudoNode.php +++ b/src/Symfony/Component/CssSelector/Node/PseudoNode.php @@ -23,14 +23,7 @@ */ class PseudoNode extends AbstractNode { - /** - * @var NodeInterface - */ private $selector; - - /** - * @var string - */ private $identifier; /** diff --git a/src/Symfony/Component/CssSelector/Node/SelectorNode.php b/src/Symfony/Component/CssSelector/Node/SelectorNode.php index 34c323b17cf6d..35392474a9ed9 100644 --- a/src/Symfony/Component/CssSelector/Node/SelectorNode.php +++ b/src/Symfony/Component/CssSelector/Node/SelectorNode.php @@ -23,14 +23,7 @@ */ class SelectorNode extends AbstractNode { - /** - * @var NodeInterface - */ private $tree; - - /** - * @var null|string - */ private $pseudoElement; /** diff --git a/src/Symfony/Component/CssSelector/Node/Specificity.php b/src/Symfony/Component/CssSelector/Node/Specificity.php index be8a0e01144cf..11228f7246d3a 100644 --- a/src/Symfony/Component/CssSelector/Node/Specificity.php +++ b/src/Symfony/Component/CssSelector/Node/Specificity.php @@ -29,19 +29,8 @@ class Specificity const B_FACTOR = 10; const C_FACTOR = 1; - /** - * @var int - */ private $a; - - /** - * @var int - */ private $b; - - /** - * @var int - */ private $c; public function __construct(int $a, int $b, int $c) @@ -65,8 +54,6 @@ public function getValue(): int * Returns -1 if the object specificity is lower than the argument, * 0 if they are equal, and 1 if the argument is lower. * - * @param Specificity $specificity - * * @return int */ public function compareTo(Specificity $specificity) diff --git a/src/Symfony/Component/CssSelector/Parser/Handler/HandlerInterface.php b/src/Symfony/Component/CssSelector/Parser/Handler/HandlerInterface.php index 10e20ac711cdb..d7ac4d332bf05 100644 --- a/src/Symfony/Component/CssSelector/Parser/Handler/HandlerInterface.php +++ b/src/Symfony/Component/CssSelector/Parser/Handler/HandlerInterface.php @@ -27,9 +27,6 @@ interface HandlerInterface { /** - * @param Reader $reader - * @param TokenStream $stream - * * @return bool */ public function handle(Reader $reader, TokenStream $stream): bool; diff --git a/src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php b/src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php index 145fe5925f384..f40807cdfbf07 100644 --- a/src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php +++ b/src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php @@ -29,20 +29,9 @@ */ class HashHandler implements HandlerInterface { - /** - * @var TokenizerPatterns - */ private $patterns; - - /** - * @var TokenizerEscaping - */ private $escaping; - /** - * @param TokenizerPatterns $patterns - * @param TokenizerEscaping $escaping - */ public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping) { $this->patterns = $patterns; diff --git a/src/Symfony/Component/CssSelector/Parser/Handler/IdentifierHandler.php b/src/Symfony/Component/CssSelector/Parser/Handler/IdentifierHandler.php index 704f939d618e2..5ea0d5fd9935d 100644 --- a/src/Symfony/Component/CssSelector/Parser/Handler/IdentifierHandler.php +++ b/src/Symfony/Component/CssSelector/Parser/Handler/IdentifierHandler.php @@ -29,20 +29,9 @@ */ class IdentifierHandler implements HandlerInterface { - /** - * @var TokenizerPatterns - */ private $patterns; - - /** - * @var TokenizerEscaping - */ private $escaping; - /** - * @param TokenizerPatterns $patterns - * @param TokenizerEscaping $escaping - */ public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping) { $this->patterns = $patterns; diff --git a/src/Symfony/Component/CssSelector/Parser/Handler/NumberHandler.php b/src/Symfony/Component/CssSelector/Parser/Handler/NumberHandler.php index 7ef2fe3171ce2..41e5844ea81e7 100644 --- a/src/Symfony/Component/CssSelector/Parser/Handler/NumberHandler.php +++ b/src/Symfony/Component/CssSelector/Parser/Handler/NumberHandler.php @@ -28,14 +28,8 @@ */ class NumberHandler implements HandlerInterface { - /** - * @var TokenizerPatterns - */ private $patterns; - /** - * @param TokenizerPatterns $patterns - */ public function __construct(TokenizerPatterns $patterns) { $this->patterns = $patterns; diff --git a/src/Symfony/Component/CssSelector/Parser/Handler/StringHandler.php b/src/Symfony/Component/CssSelector/Parser/Handler/StringHandler.php index 18a88acbc3146..fe92c1fcc7daf 100644 --- a/src/Symfony/Component/CssSelector/Parser/Handler/StringHandler.php +++ b/src/Symfony/Component/CssSelector/Parser/Handler/StringHandler.php @@ -31,20 +31,9 @@ */ class StringHandler implements HandlerInterface { - /** - * @var TokenizerPatterns - */ private $patterns; - - /** - * @var TokenizerEscaping - */ private $escaping; - /** - * @param TokenizerPatterns $patterns - * @param TokenizerEscaping $escaping - */ public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping) { $this->patterns = $patterns; diff --git a/src/Symfony/Component/CssSelector/Parser/Parser.php b/src/Symfony/Component/CssSelector/Parser/Parser.php index 13243942365ac..c4c3ddd47d0ac 100644 --- a/src/Symfony/Component/CssSelector/Parser/Parser.php +++ b/src/Symfony/Component/CssSelector/Parser/Parser.php @@ -27,14 +27,8 @@ */ class Parser implements ParserInterface { - /** - * @var Tokenizer - */ private $tokenizer; - /** - * @param null|Tokenizer $tokenizer - */ public function __construct(Tokenizer $tokenizer = null) { $this->tokenizer = $tokenizer ?: new Tokenizer(); diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index aeba0f86c06ee..7ebc0cf194250 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -59,8 +59,6 @@ class TokenStream /** * Pushes a token. * - * @param Token $token - * * @return $this */ public function push(Token $token) diff --git a/src/Symfony/Component/CssSelector/Parser/Tokenizer/Tokenizer.php b/src/Symfony/Component/CssSelector/Parser/Tokenizer/Tokenizer.php index 4c2037bb3151a..e32b4d20ce9f8 100644 --- a/src/Symfony/Component/CssSelector/Parser/Tokenizer/Tokenizer.php +++ b/src/Symfony/Component/CssSelector/Parser/Tokenizer/Tokenizer.php @@ -51,8 +51,6 @@ public function __construct() /** * Tokenize selector source code. * - * @param Reader $reader - * * @return TokenStream */ public function tokenize(Reader $reader) diff --git a/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php b/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php index 2ca10f3a13199..2df63f51621d1 100644 --- a/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php +++ b/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php @@ -23,9 +23,6 @@ */ class TokenizerEscaping { - /** - * @var TokenizerPatterns - */ private $patterns; public function __construct(TokenizerPatterns $patterns) diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php index a13ea32e5b71c..85181fd93e876 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/CombinationExtension.php @@ -39,9 +39,6 @@ public function getCombinationTranslators(): array } /** - * @param XPathExpr $xpath - * @param XPathExpr $combinedXpath - * * @return XPathExpr */ public function translateDescendant(XPathExpr $xpath, XPathExpr $combinedXpath): XPathExpr @@ -50,9 +47,6 @@ public function translateDescendant(XPathExpr $xpath, XPathExpr $combinedXpath): } /** - * @param XPathExpr $xpath - * @param XPathExpr $combinedXpath - * * @return XPathExpr */ public function translateChild(XPathExpr $xpath, XPathExpr $combinedXpath) @@ -61,9 +55,6 @@ public function translateChild(XPathExpr $xpath, XPathExpr $combinedXpath) } /** - * @param XPathExpr $xpath - * @param XPathExpr $combinedXpath - * * @return XPathExpr */ public function translateDirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath) @@ -75,9 +66,6 @@ public function translateDirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpa } /** - * @param XPathExpr $xpath - * @param XPathExpr $combinedXpath - * * @return XPathExpr */ public function translateIndirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath) diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php index ea05523055f65..c2606b5ad4308 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -111,9 +111,6 @@ public function translateNthChild(XPathExpr $xpath, FunctionNode $function, $las } /** - * @param XPathExpr $xpath - * @param FunctionNode $function - * * @return XPathExpr */ public function translateNthLastChild(XPathExpr $xpath, FunctionNode $function) @@ -122,9 +119,6 @@ public function translateNthLastChild(XPathExpr $xpath, FunctionNode $function) } /** - * @param XPathExpr $xpath - * @param FunctionNode $function - * * @return XPathExpr */ public function translateNthOfType(XPathExpr $xpath, FunctionNode $function) @@ -133,9 +127,6 @@ public function translateNthOfType(XPathExpr $xpath, FunctionNode $function) } /** - * @param XPathExpr $xpath - * @param FunctionNode $function - * * @return XPathExpr * * @throws ExpressionErrorException @@ -150,9 +141,6 @@ public function translateNthLastOfType(XPathExpr $xpath, FunctionNode $function) } /** - * @param XPathExpr $xpath - * @param FunctionNode $function - * * @return XPathExpr * * @throws ExpressionErrorException @@ -176,9 +164,6 @@ public function translateContains(XPathExpr $xpath, FunctionNode $function) } /** - * @param XPathExpr $xpath - * @param FunctionNode $function - * * @return XPathExpr * * @throws ExpressionErrorException diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php index 9fd9e937ed3a3..625ffa5cad670 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php @@ -28,9 +28,6 @@ */ class HtmlExtension extends AbstractExtension { - /** - * @param Translator $translator - */ public function __construct(Translator $translator) { $translator @@ -67,8 +64,6 @@ public function getFunctionTranslators() } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateChecked(XPathExpr $xpath) @@ -81,8 +76,6 @@ public function translateChecked(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateLink(XPathExpr $xpath) @@ -91,8 +84,6 @@ public function translateLink(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateDisabled(XPathExpr $xpath) @@ -122,8 +113,6 @@ public function translateDisabled(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateEnabled(XPathExpr $xpath) @@ -160,9 +149,6 @@ public function translateEnabled(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * @param FunctionNode $function - * * @return XPathExpr * * @throws ExpressionErrorException @@ -189,8 +175,6 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateSelected(XPathExpr $xpath) @@ -199,8 +183,6 @@ public function translateSelected(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateInvalid(XPathExpr $xpath) @@ -209,8 +191,6 @@ public function translateInvalid(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateHover(XPathExpr $xpath) @@ -219,8 +199,6 @@ public function translateHover(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateVisited(XPathExpr $xpath) diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php index 546488e503a9f..6c2473c1a2f8b 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php @@ -92,9 +92,6 @@ public function getNodeTranslators() } /** - * @param Node\SelectorNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateSelector(Node\SelectorNode $node, Translator $translator) @@ -103,9 +100,6 @@ public function translateSelector(Node\SelectorNode $node, Translator $translato } /** - * @param Node\CombinedSelectorNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateCombinedSelector(Node\CombinedSelectorNode $node, Translator $translator) @@ -114,9 +108,6 @@ public function translateCombinedSelector(Node\CombinedSelectorNode $node, Trans } /** - * @param Node\NegationNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateNegation(Node\NegationNode $node, Translator $translator) @@ -133,9 +124,6 @@ public function translateNegation(Node\NegationNode $node, Translator $translato } /** - * @param Node\FunctionNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateFunction(Node\FunctionNode $node, Translator $translator) @@ -146,9 +134,6 @@ public function translateFunction(Node\FunctionNode $node, Translator $translato } /** - * @param Node\PseudoNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translatePseudo(Node\PseudoNode $node, Translator $translator) @@ -159,9 +144,6 @@ public function translatePseudo(Node\PseudoNode $node, Translator $translator) } /** - * @param Node\AttributeNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateAttribute(Node\AttributeNode $node, Translator $translator) @@ -190,9 +172,6 @@ public function translateAttribute(Node\AttributeNode $node, Translator $transla } /** - * @param Node\ClassNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateClass(Node\ClassNode $node, Translator $translator) @@ -203,9 +182,6 @@ public function translateClass(Node\ClassNode $node, Translator $translator) } /** - * @param Node\HashNode $node - * @param Translator $translator - * * @return XPathExpr */ public function translateHash(Node\HashNode $node, Translator $translator) @@ -216,8 +192,6 @@ public function translateHash(Node\HashNode $node, Translator $translator) } /** - * @param Node\ElementNode $node - * * @return XPathExpr */ public function translateElement(Node\ElementNode $node) diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php index 1c8b217e39c09..378dfb7de1773 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/PseudoClassExtension.php @@ -44,8 +44,6 @@ public function getPseudoClassTranslators() } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateRoot(XPathExpr $xpath) @@ -54,8 +52,6 @@ public function translateRoot(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateFirstChild(XPathExpr $xpath) @@ -67,8 +63,6 @@ public function translateFirstChild(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateLastChild(XPathExpr $xpath) @@ -80,8 +74,6 @@ public function translateLastChild(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr * * @throws ExpressionErrorException @@ -98,8 +90,6 @@ public function translateFirstOfType(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr * * @throws ExpressionErrorException @@ -116,8 +106,6 @@ public function translateLastOfType(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateOnlyChild(XPathExpr $xpath) @@ -129,8 +117,6 @@ public function translateOnlyChild(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr * * @throws ExpressionErrorException @@ -145,8 +131,6 @@ public function translateOnlyOfType(XPathExpr $xpath) } /** - * @param XPathExpr $xpath - * * @return XPathExpr */ public function translateEmpty(XPathExpr $xpath) diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php index 4c43f3c9ebdfa..f66a13d685778 100644 --- a/src/Symfony/Component/CssSelector/XPath/Translator.php +++ b/src/Symfony/Component/CssSelector/XPath/Translator.php @@ -30,9 +30,6 @@ */ class Translator implements TranslatorInterface { - /** - * @var ParserInterface - */ private $mainParser; /** @@ -41,33 +38,14 @@ class Translator implements TranslatorInterface private $shortcutParsers = array(); /** - * @var Extension\ExtensionInterface + * @var Extension\ExtensionInterface[] */ private $extensions = array(); - /** - * @var array - */ private $nodeTranslators = array(); - - /** - * @var array - */ private $combinationTranslators = array(); - - /** - * @var array - */ private $functionTranslators = array(); - - /** - * @var array - */ private $pseudoClassTranslators = array(); - - /** - * @var array - */ private $attributeMatchingTranslators = array(); public function __construct(ParserInterface $parser = null) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 74ee9f8acf3ac..758f6f03b6925 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -165,18 +165,11 @@ public function loadClass($class) } // Don't trigger deprecations for classes in the same vendor - if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) { + if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) { $len = 0; $ns = ''; } else { - switch ($ns = substr($name, 0, $len)) { - case 'Symfony\Bridge\\': - case 'Symfony\Bundle\\': - case 'Symfony\Component\\': - $ns = 'Symfony\\'; - $len = strlen($ns); - break; - } + $ns = substr($name, 0, $len); } // Detect annotations on the class diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index a82a3246d9eaa..97470cb6b4d01 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -196,8 +196,6 @@ public function getHtml($exception) /** * Gets the HTML content associated with the given exception. * - * @param FlattenException $exception A FlattenException instance - * * @return string The content as a string */ public function getContent(FlattenException $exception) @@ -276,8 +274,6 @@ public function getContent(FlattenException $exception) /** * Gets the stylesheet associated with the given exception. * - * @param FlattenException $exception A FlattenException instance - * * @return string The stylesheet as a string */ public function getStylesheet(FlattenException $exception) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index 99eed81fcc4dd..096b044dc04b9 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -55,8 +55,6 @@ public function setRepeatedPass(RepeatedPass $repeatedPass) /** * Processes a ContainerBuilder object to populate the service reference graph. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { @@ -127,28 +125,21 @@ protected function processValue($value, $isRoot = false) return $value; } - /** - * Returns a service definition given the full name or an alias. - * - * @param string $id A full id or alias for a service definition - * - * @return Definition|null The definition related to the supplied id - */ - private function getDefinition($id) + private function getDefinition(string $id): ?Definition { $id = $this->getDefinitionId($id); return null === $id ? null : $this->container->getDefinition($id); } - private function getDefinitionId($id) + private function getDefinitionId(string $id): ?string { while ($this->container->hasAlias($id)) { $id = (string) $this->container->getAlias($id); } if (!$this->container->hasDefinition($id)) { - return; + return null; } return $id; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php index 6af2778c61c8c..1e2d5a4a73e89 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php @@ -31,8 +31,6 @@ class CheckCircularReferencesPass implements CompilerPassInterface /** * Checks the ContainerBuilder object for circular references. - * - * @param ContainerBuilder $container The ContainerBuilder instances */ public function process(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php index a43e0cd78f404..a8a652c7a2319 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\EnvParameterException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; /** @@ -31,8 +32,6 @@ class CheckDefinitionValidityPass implements CompilerPassInterface /** * Processes the ContainerBuilder to validate the Definition. * - * @param ContainerBuilder $container - * * @throws RuntimeException When the Definition is invalid */ public function process(ContainerBuilder $container) @@ -77,6 +76,18 @@ public function process(ContainerBuilder $container) } } } + + $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); + if (null !== $usedEnvs) { + throw new EnvParameterException(array($resolvedId), null, 'A service name ("%s") cannot contain dynamic values.'); + } + } + + foreach ($container->getAliases() as $id => $alias) { + $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); + if (null !== $usedEnvs) { + throw new EnvParameterException(array($resolvedId), null, 'An alias name ("%s") cannot contain dynamic values.'); + } } } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index e58b3dbe7fce5..abc6205a969b6 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -66,7 +66,7 @@ public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BE /** * @final */ - public function log(CompilerPassInterface $pass, $message) + public function log(CompilerPassInterface $pass, string $message) { if (false !== strpos($message, "\n")) { $message = str_replace("\n", "\n".get_class($pass).': ', trim($message)); @@ -87,8 +87,6 @@ public function getLog() /** * Run the Compiler and process all Passes. - * - * @param ContainerBuilder $container */ public function compile(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php index 30cb1d5d466f3..308500605893d 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php @@ -22,8 +22,6 @@ interface CompilerPassInterface { /** * You can modify the container here before it is dumped to PHP code. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index d9c18f0fe35a9..3329add737e85 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -192,11 +192,6 @@ public function getMergePass() return $this->mergePass; } - /** - * Sets the Merge Pass. - * - * @param CompilerPassInterface $pass The merge pass - */ public function setMergePass(CompilerPassInterface $pass) { $this->mergePass = $pass; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RegisterEnvVarProcessorsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RegisterEnvVarProcessorsPass.php index 38349f06569a6..b99c252fef8d0 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RegisterEnvVarProcessorsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RegisterEnvVarProcessorsPass.php @@ -13,6 +13,7 @@ use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\EnvVarProcessor; use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; @@ -45,10 +46,16 @@ public function process(ContainerBuilder $container) } } - if ($processors) { - if ($bag instanceof EnvPlaceholderParameterBag) { - $bag->setProvidedTypes($types); + if ($bag instanceof EnvPlaceholderParameterBag) { + foreach (EnvVarProcessor::getProvidedTypes() as $prefix => $type) { + if (!isset($types[$prefix])) { + $types[$prefix] = self::validateProvidedTypes($type, EnvVarProcessor::class); + } } + $bag->setProvidedTypes($types); + } + + if ($processors) { $container->register('container.env_var_processors_locator', ServiceLocator::class) ->setPublic(true) ->setArguments(array($processors)) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php index 0ce79daa79977..04b6852fab345 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php @@ -20,8 +20,6 @@ class RemoveAbstractDefinitionsPass implements CompilerPassInterface { /** * Removes abstract definitions from the ContainerBuilder. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php index 5d6d51d6916f3..75b36d227eab3 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php @@ -24,8 +24,6 @@ class RemovePrivateAliasesPass implements CompilerPassInterface { /** * Removes private aliases from the ContainerBuilder. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php index 69ec66bf8f5b8..ec2eed27edbc8 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php @@ -32,8 +32,6 @@ public function setRepeatedPass(RepeatedPass $repeatedPass) /** * Processes the ContainerBuilder to remove unused definitions. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php index d60ae35bc8f0b..2b88bfb917a0f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php @@ -19,10 +19,5 @@ */ interface RepeatablePassInterface extends CompilerPassInterface { - /** - * Sets the RepeatedPass interface. - * - * @param RepeatedPass $repeatedPass - */ public function setRepeatedPass(RepeatedPass $repeatedPass); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php index 59d4e0a767a5a..cdc9ddb507c38 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php @@ -51,8 +51,6 @@ public function __construct(array $passes) /** * Process the repeatable passes that run more than once. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index ad24f1815a7bf..9a27b371b247c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -28,8 +28,6 @@ class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass /** * Process the Container to replace aliases with service definitions. * - * @param ContainerBuilder $container - * * @throws InvalidArgumentException if the service definition does not exist */ public function process(ContainerBuilder $container) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php index 690dce7efe8ae..cb05f90143525 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php @@ -32,8 +32,6 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface /** * Process the ContainerBuilder to resolve invalid references. - * - * @param ContainerBuilder $container */ public function process(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php index d9cd241d76e53..2c4a09f8476f9 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php @@ -78,6 +78,9 @@ protected function processValue($value, $isRoot = false) public static function register(ContainerBuilder $container, array $refMap) { foreach ($refMap as $id => $ref) { + if (!$ref instanceof Reference) { + throw new InvalidArgumentException(sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', is_object($ref) ? get_class($ref) : gettype($ref), $id)); + } $refMap[$id] = new ServiceClosureArgument($ref); } ksort($refMap); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php index 5e732c2e7c193..0474541f3d761 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php @@ -30,14 +30,7 @@ class ServiceReferenceGraph */ private $nodes = array(); - /** - * Checks if the graph has a specific node. - * - * @param string $id Id to check - * - * @return bool - */ - public function hasNode($id) + public function hasNode(string $id): bool { return isset($this->nodes[$id]); } @@ -45,13 +38,9 @@ public function hasNode($id) /** * Gets a node by identifier. * - * @param string $id The id to retrieve - * - * @return ServiceReferenceGraphNode - * * @throws InvalidArgumentException if no node matches the supplied identifier */ - public function getNode($id) + public function getNode(string $id): ServiceReferenceGraphNode { if (!isset($this->nodes[$id])) { throw new InvalidArgumentException(sprintf('There is no node with id "%s".', $id)); @@ -65,7 +54,7 @@ public function getNode($id) * * @return ServiceReferenceGraphNode[] */ - public function getNodes() + public function getNodes(): array { return $this->nodes; } @@ -80,17 +69,13 @@ public function clear() /** * Connects 2 nodes together in the Graph. - * - * @param string $sourceId - * @param string $sourceValue - * @param string $destId - * @param string $destValue - * @param string $reference - * @param bool $lazy - * @param bool $weak */ - public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null, bool $lazy = false, bool $weak = false) + public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, $reference = null, bool $lazy = false, bool $weak = false) { + if (null === $sourceId || null === $destId) { + return; + } + $sourceNode = $this->createNode($sourceId, $sourceValue); $destNode = $this->createNode($destId, $destValue); $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak); @@ -99,15 +84,7 @@ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $re $destNode->addInEdge($edge); } - /** - * Creates a graph node. - * - * @param string $id - * @param string $value - * - * @return ServiceReferenceGraphNode - */ - private function createNode($id, $value) + private function createNode(string $id, $value): ServiceReferenceGraphNode { if (isset($this->nodes[$id]) && $this->nodes[$id]->getValue() === $value) { return $this->nodes[$id]; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php index 5b8256977f8e4..3e5b9c92c5433 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php @@ -26,14 +26,7 @@ class ServiceReferenceGraphEdge private $lazy; private $weak; - /** - * @param ServiceReferenceGraphNode $sourceNode - * @param ServiceReferenceGraphNode $destNode - * @param string $value - * @param bool $lazy - * @param bool $weak - */ - public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false) + public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, bool $lazy = false, bool $weak = false) { $this->sourceNode = $sourceNode; $this->destNode = $destNode; @@ -45,7 +38,7 @@ public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceRefere /** * Returns the value of the edge. * - * @return string + * @return mixed */ public function getValue() { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php index e5718b2b6d59a..3219d06e96989 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php @@ -38,21 +38,11 @@ public function __construct($id, $value) $this->value = $value; } - /** - * Adds an in edge to this node. - * - * @param ServiceReferenceGraphEdge $edge - */ public function addInEdge(ServiceReferenceGraphEdge $edge) { $this->inEdges[] = $edge; } - /** - * Adds an out edge to this node. - * - * @param ServiceReferenceGraphEdge $edge - */ public function addOutEdge(ServiceReferenceGraphEdge $edge) { $this->outEdges[] = $edge; diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 7d4e60874f0a3..f5728e03c4bf7 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -39,11 +39,7 @@ */ class Container implements ResettableContainerInterface { - /** - * @var ParameterBagInterface - */ protected $parameterBag; - protected $services = array(); protected $fileMap = array(); protected $methodMap = array(); @@ -56,9 +52,6 @@ class Container implements ResettableContainerInterface private $compiled = false; private $getEnv; - /** - * @param ParameterBagInterface $parameterBag A ParameterBagInterface instance - */ public function __construct(ParameterBagInterface $parameterBag = null) { $this->parameterBag = $parameterBag ?: new EnvPlaceholderParameterBag(); diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php index fe301b6270bb9..d78491bb96335 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -18,10 +18,5 @@ */ interface ContainerAwareInterface { - /** - * Sets the container. - * - * @param ContainerInterface|null $container A ContainerInterface instance or null - */ public function setContainer(ContainerInterface $container = null); } diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php index ccf064f6f3b57..ee1ea2cb3d148 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php @@ -23,11 +23,6 @@ trait ContainerAwareTrait */ protected $container; - /** - * Sets the container. - * - * @param ContainerInterface|null $container A ContainerInterface instance or null - */ public function setContainer(ContainerInterface $container = null) { $this->container = $container; diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 733b0acd5e02b..2e1d245e8181a 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -162,19 +162,12 @@ public function isTrackingResources() /** * Sets the instantiator to be used when fetching proxies. - * - * @param InstantiatorInterface $proxyInstantiator */ public function setProxyInstantiator(InstantiatorInterface $proxyInstantiator) { $this->proxyInstantiator = $proxyInstantiator; } - /** - * Registers an extension. - * - * @param ExtensionInterface $extension An extension instance - */ public function registerExtension(ExtensionInterface $extension) { $this->extensions[$extension->getAlias()] = $extension; @@ -239,10 +232,6 @@ public function getResources() } /** - * Adds a resource for this configuration. - * - * @param ResourceInterface $resource A resource instance - * * @return $this */ public function addResource(ResourceInterface $resource) @@ -322,19 +311,14 @@ public function addObjectResource($object) /** * Retrieves the requested reflection class and registers it for resource tracking. * - * @param string $class - * @param bool $throw - * - * @return \ReflectionClass|null - * * @throws \ReflectionException when a parent class/interface/trait is not found and $throw is true * * @final */ - public function getReflectionClass($class, $throw = true) + public function getReflectionClass(?string $class, bool $throw = true): ?\ReflectionClass { if (!$class = $this->getParameterBag()->resolveValue($class)) { - return; + return null; } $resource = null; @@ -379,7 +363,7 @@ public function getReflectionClass($class, $throw = true) * * @final */ - public function fileExists($path, $trackContents = true) + public function fileExists(string $path, $trackContents = true): bool { $exists = file_exists($path); @@ -584,8 +568,6 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV * parameter, the value will still be 'bar' as defined in the ContainerBuilder * constructor. * - * @param ContainerBuilder $container The ContainerBuilder instance to merge - * * @throws BadMethodCallException When this ContainerBuilder is compiled */ public function merge(ContainerBuilder $container) @@ -747,8 +729,6 @@ public function getRemovedIds() /** * Adds the service aliases. - * - * @param array $aliases An array of aliases */ public function addAliases(array $aliases) { @@ -759,8 +739,6 @@ public function addAliases(array $aliases) /** * Sets the service aliases. - * - * @param array $aliases An array of aliases */ public function setAliases(array $aliases) { @@ -1343,7 +1321,7 @@ public function getEnvCounters() /** * @final */ - public function log(CompilerPassInterface $pass, $message) + public function log(CompilerPassInterface $pass, string $message) { $this->getCompiler()->log($pass, $message); } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 0044a02be192e..989725d53db5b 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -182,8 +182,6 @@ public function getClass() /** * Sets the arguments to pass to the service constructor/factory method. * - * @param array $arguments An array of arguments - * * @return $this */ public function setArguments(array $arguments) @@ -196,8 +194,6 @@ public function setArguments(array $arguments) /** * Sets the properties to define when creating the service. * - * @param array $properties - * * @return $this */ public function setProperties(array $properties) @@ -321,8 +317,6 @@ public function getArgument($index) /** * Sets the methods to call after service initialization. * - * @param array $calls An array of method calls - * * @return $this */ public function setMethodCalls(array $calls = array()) @@ -453,8 +447,6 @@ public function isAutoconfigured() /** * Sets tags for this definition. * - * @param array $tags - * * @return $this */ public function setTags(array $tags) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php b/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php index a39a5c744ba78..e7407b0e2a8bf 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php @@ -22,9 +22,6 @@ abstract class Dumper implements DumperInterface { protected $container; - /** - * @param ContainerBuilder $container The service container to dump - */ public function __construct(ContainerBuilder $container) { $this->container = $container; diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 3b94d7bf2f03b..366b2fd4efde7 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -90,8 +90,6 @@ public function __construct(ContainerBuilder $container) /** * Sets the dumper to be used when dumping proxies in the generated container. - * - * @param ProxyDumper $proxyDumper */ public function setProxyDumper(ProxyDumper $proxyDumper) { @@ -108,8 +106,6 @@ public function setProxyDumper(ProxyDumper $proxyDumper) * * namespace: The class namespace * * as_files: To split the container in several files * - * @param array $options An array of options - * * @return string|array A PHP class representing the service container or an array of PHP files if the "as_files" option is set * * @throws EnvParameterException When an env var exists but has not been dumped @@ -333,9 +329,6 @@ private function generateProxyClasses() /** * Generates the require_once statement for service includes. * - * @param Definition $definition - * @param array $inlinedDefinitions - * * @return string */ private function addServiceInclude(Definition $definition, array $inlinedDefinitions) @@ -1311,10 +1304,6 @@ private function getServiceConditionals($value) /** * Builds service calls from arguments. - * - * @param array $arguments - * @param array &$calls By reference - * @param array &$behavior By reference */ private function getServiceCallsFromArguments(array $arguments, array &$calls, array &$behavior) { @@ -1341,8 +1330,6 @@ private function getServiceCallsFromArguments(array $arguments, array &$calls, a /** * Returns the inline definition. * - * @param Definition $definition - * * @return array */ private function getInlinedDefinitions(Definition $definition) @@ -1367,8 +1354,6 @@ private function getInlinedDefinitions(Definition $definition) /** * Gets the definition from arguments. * - * @param array $arguments - * * @return array */ private function getDefinitionsFromArguments(array $arguments) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 94b6934d9c0a4..defbc7ae89da4 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -38,8 +38,6 @@ class XmlDumper extends Dumper /** * Dumps the service container as an XML string. * - * @param array $options An array of options - * * @return string An xml string representing of the service container */ public function dump(array $options = array()) @@ -61,11 +59,6 @@ public function dump(array $options = array()) return $this->container->resolveEnvPlaceholders($xml); } - /** - * Adds parameters. - * - * @param \DOMElement $parent - */ private function addParameters(\DOMElement $parent) { $data = $this->container->getParameterBag()->all(); @@ -82,12 +75,6 @@ private function addParameters(\DOMElement $parent) $this->convertParameters($data, 'parameter', $parameters); } - /** - * Adds method calls. - * - * @param array $methodcalls - * @param \DOMElement $parent - */ private function addMethodCalls(array $methodcalls, \DOMElement $parent) { foreach ($methodcalls as $methodcall) { @@ -242,11 +229,6 @@ private function addServiceAlias($alias, Alias $id, \DOMElement $parent) $parent->appendChild($service); } - /** - * Adds services. - * - * @param \DOMElement $parent - */ private function addServices(\DOMElement $parent) { $definitions = $this->container->getDefinitions(); @@ -330,8 +312,6 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent /** * Escapes arguments. * - * @param array $arguments - * * @return array */ private function escape(array $arguments) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 93d2e8160ee25..a9a11b25f30ff 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -39,8 +39,6 @@ class YamlDumper extends Dumper /** * Dumps the service container as an YAML string. * - * @param array $options An array of options - * * @return string A YAML string representing of the service container */ public function dump(array $options = array()) @@ -64,7 +62,7 @@ public function dump(array $options = array()) * * @return string */ - private function addService($id, $definition) + private function addService($id, Definition $definition) { $code = " $id:\n"; if ($class = $definition->getClass()) { @@ -169,7 +167,7 @@ private function addService($id, $definition) * * @return string */ - private function addServiceAlias($alias, $id) + private function addServiceAlias($alias, Alias $id) { if ($id->isPrivate()) { return sprintf(" %s: '@%s'\n", $alias, $id); @@ -355,8 +353,6 @@ private function prepareParameters(array $parameters, $escape = true) /** * Escapes arguments. * - * @param array $arguments - * * @return array */ private function escape(array $arguments) diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php index 63bb5bc8c0079..bf34c593d638a 100644 --- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php +++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php @@ -67,10 +67,10 @@ public function getEnv($prefix, $name, \Closure $getEnv) if (null === $env = $getEnv($name)) { return; } - } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { - $env = $_SERVER[$name]; } elseif (isset($_ENV[$name])) { $env = $_ENV[$name]; + } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { + $env = $_SERVER[$name]; } elseif (false === ($env = getenv($name)) || null === $env) { // null is a possible value because of thread safety issues if (!$this->container->hasParameter("env($name)")) { throw new EnvNotFoundException($name); diff --git a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php index 705ba38ec9ccc..da590635bccda 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -24,9 +24,6 @@ interface ConfigurationExtensionInterface /** * Returns extension configuration. * - * @param array $config An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * * @return ConfigurationInterface|null The configuration or null */ public function getConfiguration(array $config, ContainerBuilder $container); diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php index 9bcbedbf84695..9542c740e166a 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php +++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -109,9 +109,6 @@ final public function getProcessedConfigs() } /** - * @param ContainerBuilder $container - * @param array $config - * * @return bool Whether the configuration is enabled * * @throws InvalidArgumentException When the config is not enableable diff --git a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php index 6e926fa7a8adc..18de31272f322 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -23,9 +23,6 @@ interface ExtensionInterface /** * Loads a specific configuration. * - * @param array $configs An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * * @throws \InvalidArgumentException When provided tag is not defined in this extension */ public function load(array $configs, ContainerBuilder $container); diff --git a/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php index c666bdbcf8d45..5bd18d79feac9 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php @@ -17,8 +17,6 @@ interface PrependExtensionInterface { /** * Allow an extension to prepend the extension configurations. - * - * @param ContainerBuilder $container */ public function prepend(ContainerBuilder $container); } diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php index 58907aa317cba..14295eb8cfd42 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php @@ -23,8 +23,6 @@ interface DumperInterface /** * Inspects whether the given definitions should produce proxy instantiation logic in the dumped container. * - * @param Definition $definition - * * @return bool */ public function isProxyCandidate(Definition $definition); @@ -43,8 +41,6 @@ public function getProxyFactoryCode(Definition $definition, $id, $factoryCode); /** * Generates the code for the lazy proxy. * - * @param Definition $definition - * * @return string */ public function getProxyCode(Definition $definition); diff --git a/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php b/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php index df70cdf44f283..f8f2efe2e9e64 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php @@ -25,9 +25,6 @@ class ClosureLoader extends Loader { private $container; - /** - * @param ContainerBuilder $container A ContainerBuilder instance - */ public function __construct(ContainerBuilder $container) { $this->container = $container; diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php index 4c3f1dc0f8c31..adf294b9928d9 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php @@ -40,7 +40,7 @@ class DefaultsConfigurator extends AbstractServiceConfigurator final public function tag($name, array $attributes = array()) { if (!is_string($name) || '' === $name) { - throw new InvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string.')); + throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); } foreach ($attributes as $attribute => $value) { diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index d49ecebc67797..55809e517852b 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -30,10 +30,6 @@ abstract class FileLoader extends BaseFileLoader protected $isLoadingInstanceof = false; protected $instanceof = array(); - /** - * @param ContainerBuilder $container A ContainerBuilder instance - * @param FileLocatorInterface $locator A FileLocator instance - */ public function __construct(ContainerBuilder $container, FileLocatorInterface $locator) { $this->container = $container; diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index d3b261d57b177..9bb1ccb1e0223 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -775,8 +775,6 @@ private function resolveServices($value, $file, $isParameter = false) /** * Loads from Extensions. - * - * @param array $content */ private function loadFromExtensions(array $content) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php index 585bb357669b4..473d5667d448e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php @@ -76,6 +76,30 @@ public function testInvalidTags() $this->process($container); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException + */ + public function testDynamicServiceName() + { + $container = new ContainerBuilder(); + $env = $container->getParameterBag()->get('env(BAR)'); + $container->register("foo.$env", 'class'); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException + */ + public function testDynamicAliasName() + { + $container = new ContainerBuilder(); + $env = $container->getParameterBag()->get('env(BAR)'); + $container->setAlias("foo.$env", 'class'); + + $this->process($container); + } + protected function process(ContainerBuilder $container) { $pass = new CheckDefinitionValidityPass(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php index dc3a1f1834f5e..d807a6fa41ba9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php @@ -28,7 +28,20 @@ public function testSimpleProcessor() $this->assertTrue($container->has('container.env_var_processors_locator')); $this->assertInstanceof(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo')); - $this->assertSame(array('foo' => array('string')), $container->getParameterBag()->getProvidedTypes()); + $expected = array( + 'foo' => array('string'), + 'base64' => array('string'), + 'bool' => array('bool'), + 'const' => array('bool', 'int', 'float', 'string', 'array'), + 'file' => array('string'), + 'float' => array('float'), + 'int' => array('int'), + 'json' => array('array'), + 'resolve' => array('string'), + 'string' => array('string'), + ); + + $this->assertSame($expected, $container->getParameterBag()->getProvidedTypes()); } public function testNoProcessor() diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 5d201dff1eef6..6da1a569d25fa 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -743,7 +743,7 @@ public function selectImage($value) public function selectButton($value) { $translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'; - $xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, $translate, static::xpathLiteral(' '.$value.' ')). + $xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, static::xpathLiteral(' '.$value.' ')). sprintf('or (contains(%s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)) or @id=%s or @name=%s] ', $translate, static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)). sprintf('| descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) or @id=%s or @name=%s]', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)); @@ -1071,7 +1071,7 @@ public function count() } /** - * @return \ArrayIterator + * @return \ArrayIterator|\DOMElement[] */ public function getIterator() { diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php index 683afb54eeac4..8eaae3e3891e5 100644 --- a/src/Symfony/Component/DomCrawler/Form.php +++ b/src/Symfony/Component/DomCrawler/Form.php @@ -288,8 +288,6 @@ public function get($name) /** * Sets a named field. - * - * @param FormField $field The field */ public function set(FormField $field) { @@ -376,8 +374,6 @@ public function disableValidation() * * Expects a 'submit' button \DOMElement and finds the corresponding form element, or the form element itself. * - * @param \DOMElement $node A \DOMElement instance - * * @throws \LogicException If given node is not a button or input or does not have a form ancestor */ protected function setNode(\DOMElement $node) @@ -447,7 +443,7 @@ private function initialize() // corresponding elements are either descendants or have a matching HTML5 form attribute $formId = Crawler::xpathLiteral($this->node->getAttribute('id')); - $fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%s] | descendant::textarea[@form=%s] | descendant::select[@form=%s] | //form[@id=%s]//input[not(@form)] | //form[@id=%s]//button[not(@form)] | //form[@id=%s]//textarea[not(@form)] | //form[@id=%s]//select[not(@form)]', $formId, $formId, $formId, $formId, $formId, $formId, $formId, $formId)); + $fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%1$s] | descendant::textarea[@form=%1$s] | descendant::select[@form=%1$s] | //form[@id=%1$s]//input[not(@form)] | //form[@id=%1$s]//button[not(@form)] | //form[@id=%1$s]//textarea[not(@form)] | //form[@id=%1$s]//select[not(@form)]', $formId)); foreach ($fieldNodes as $node) { $this->addField($node); } diff --git a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php index 9168dd365af98..6ad6d933e406a 100644 --- a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php +++ b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php @@ -26,8 +26,6 @@ class FormFieldRegistry /** * Adds a field to the registry. - * - * @param FormField $field The field */ public function add(FormField $field) { diff --git a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php index 2fb795f77b246..9b5c689ad7137 100644 --- a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php @@ -33,11 +33,6 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface private $dispatcher; private $wrappedListeners; - /** - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param LoggerInterface $logger A LoggerInterface instance - */ public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null) { $this->dispatcher = $dispatcher; diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index 6e0b11fce2ab5..ba85df28366bc 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -48,8 +48,6 @@ public function addListener($eventName, $listener, $priority = 0); * * The subscriber is asked for all the events he is * interested in and added as a listener for these events. - * - * @param EventSubscriberInterface $subscriber The subscriber */ public function addSubscriber(EventSubscriberInterface $subscriber); @@ -61,11 +59,6 @@ public function addSubscriber(EventSubscriberInterface $subscriber); */ public function removeListener($eventName, $listener); - /** - * Removes an event subscriber. - * - * @param EventSubscriberInterface $subscriber The subscriber - */ public function removeSubscriber(EventSubscriberInterface $subscriber); /** diff --git a/src/Symfony/Component/EventDispatcher/GenericEvent.php b/src/Symfony/Component/EventDispatcher/GenericEvent.php index a7520a0f34567..8907a0c2dc8d0 100644 --- a/src/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/src/Symfony/Component/EventDispatcher/GenericEvent.php @@ -29,8 +29,6 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate /** * Array of arguments. - * - * @var array */ protected $arguments; diff --git a/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php index 7f2be8d3145d6..b3cf56c502dba 100644 --- a/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php @@ -18,18 +18,8 @@ */ class ImmutableEventDispatcher implements EventDispatcherInterface { - /** - * The proxied dispatcher. - * - * @var EventDispatcherInterface - */ private $dispatcher; - /** - * Creates an unmodifiable proxy for an event dispatcher. - * - * @param EventDispatcherInterface $dispatcher The proxied event dispatcher - */ public function __construct(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; diff --git a/src/Symfony/Component/ExpressionLanguage/Compiler.php b/src/Symfony/Component/ExpressionLanguage/Compiler.php index f32ec36d306f2..66d106041fde9 100644 --- a/src/Symfony/Component/ExpressionLanguage/Compiler.php +++ b/src/Symfony/Component/ExpressionLanguage/Compiler.php @@ -51,8 +51,6 @@ public function reset() /** * Compiles a node. * - * @param Node\Node $node The node to compile - * * @return $this */ public function compile(Node\Node $node) diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php index b93a7df8a3a06..e1a2f2e904796 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php @@ -38,8 +38,6 @@ public function addElement(Node $value, Node $key = null) /** * Compiles the node to PHP. - * - * @param Compiler $compiler A Compiler instance */ public function compile(Compiler $compiler) { diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 9d4a9573166b2..07dce771b4fc9 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -373,8 +373,6 @@ public static function addVCSPattern($pattern) * * This can be slow as all the matching files and directories must be retrieved for comparison. * - * @param \Closure $closure An anonymous function - * * @return $this * * @see SortableIterator @@ -480,8 +478,6 @@ public function sortByModifiedTime() * The anonymous function receives a \SplFileInfo and must return false * to remove files. * - * @param \Closure $closure An anonymous function - * * @return $this * * @see CustomFilterIterator diff --git a/src/Symfony/Component/Form/AbstractRendererEngine.php b/src/Symfony/Component/Form/AbstractRendererEngine.php index ab39f1fed309b..87f2f73a9c924 100644 --- a/src/Symfony/Component/Form/AbstractRendererEngine.php +++ b/src/Symfony/Component/Form/AbstractRendererEngine.php @@ -23,29 +23,11 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface */ const CACHE_KEY_VAR = 'cache_key'; - /** - * @var array - */ protected $defaultThemes; - - /** - * @var array - */ protected $themes = array(); - - /** - * @var array - */ protected $useDefaultThemes = array(); - - /** - * @var array - */ protected $resources = array(); - /** - * @var array - */ private $resourceHierarchyLevels = array(); /** @@ -62,15 +44,13 @@ public function __construct(array $defaultThemes = array()) /** * {@inheritdoc} */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */) + public function setTheme(FormView $view, $themes, $useDefaultThemes = true) { $cacheKey = $view->vars[self::CACHE_KEY_VAR]; // Do not cast, as casting turns objects into arrays of properties $this->themes[$cacheKey] = is_array($themes) ? $themes : array($themes); - - $args = func_get_args(); - $this->useDefaultThemes[$cacheKey] = isset($args[2]) ? (bool) $args[2] : true; + $this->useDefaultThemes[$cacheKey] = (bool) $useDefaultThemes; // Unset instead of resetting to an empty array, in order to allow // implementations (like TwigRendererEngine) to check whether $cacheKey diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php index 9a5f8a60bd433..3dbe110fcb084 100644 --- a/src/Symfony/Component/Form/Button.php +++ b/src/Symfony/Component/Form/Button.php @@ -273,8 +273,6 @@ public function getPropertyPath() /** * Unsupported method. * - * @param FormError $error - * * @throws BadMethodCallException */ public function addError(FormError $error) diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 3c036fe2d04ff..7864116d23dcb 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -184,8 +184,6 @@ public function addEventListener($eventName, $listener, $priority = 0) * * This method should not be invoked. * - * @param EventSubscriberInterface $subscriber - * * @throws BadMethodCallException */ public function addEventSubscriber(EventSubscriberInterface $subscriber) @@ -272,8 +270,6 @@ public function setAttributes(array $attributes) * * This method should not be invoked. * - * @param DataMapperInterface $dataMapper - * * @throws BadMethodCallException */ public function setDataMapper(DataMapperInterface $dataMapper = null) @@ -396,8 +392,6 @@ public function setCompound($compound) /** * Sets the type of the button. * - * @param ResolvedFormTypeInterface $type The type of the button - * * @return $this */ public function setType(ResolvedFormTypeInterface $type) @@ -440,8 +434,6 @@ public function setDataLocked($locked) * * This method should not be invoked. * - * @param FormFactoryInterface $formFactory - * * @throws BadMethodCallException */ public function setFormFactory(FormFactoryInterface $formFactory) @@ -476,8 +468,6 @@ public function setMethod($method) /** * Unsupported method. * - * @param RequestHandlerInterface $requestHandler - * * @throws BadMethodCallException */ public function setRequestHandler(RequestHandlerInterface $requestHandler) diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php index d3460ecacad94..1e571ed81c062 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php @@ -22,9 +22,6 @@ */ class CachingFactoryDecorator implements ChoiceListFactoryInterface { - /** - * @var ChoiceListFactoryInterface - */ private $decoratedFactory; /** @@ -89,11 +86,6 @@ private static function flatten(array $array, &$output) } } - /** - * Decorates the given factory. - * - * @param ChoiceListFactoryInterface $decoratedFactory The decorated factory - */ public function __construct(ChoiceListFactoryInterface $decoratedFactory) { $this->decoratedFactory = $decoratedFactory; diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php index 5604e6910bc48..b7e3d9240f719 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php @@ -41,22 +41,9 @@ */ class PropertyAccessDecorator implements ChoiceListFactoryInterface { - /** - * @var ChoiceListFactoryInterface - */ private $decoratedFactory; - - /** - * @var PropertyAccessorInterface - */ private $propertyAccessor; - /** - * Decorates the given factory. - * - * @param ChoiceListFactoryInterface $decoratedFactory The decorated factory - * @param null|PropertyAccessorInterface $propertyAccessor The used property accessor - */ public function __construct(ChoiceListFactoryInterface $decoratedFactory, PropertyAccessorInterface $propertyAccessor = null) { $this->decoratedFactory = $decoratedFactory; diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php index 6009597c044d8..c6a88e4340592 100644 --- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php +++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php @@ -41,8 +41,6 @@ class ChoiceView /** * Additional attributes for the HTML tag. - * - * @var array */ public $attr; diff --git a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php index 736752a41e19c..25aba9a16d430 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php +++ b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php @@ -23,16 +23,8 @@ */ class PropertyPathMapper implements DataMapperInterface { - /** - * @var PropertyAccessorInterface - */ private $propertyAccessor; - /** - * Creates a new property path mapper. - * - * @param PropertyAccessorInterface $propertyAccessor The property accessor - */ public function __construct(PropertyAccessorInterface $propertyAccessor = null) { $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php index 369a12343facd..e8424b92994ab 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php @@ -22,9 +22,6 @@ class ChoiceToValueTransformer implements DataTransformerInterface { private $choiceList; - /** - * @param ChoiceListInterface $choiceList - */ public function __construct(ChoiceListInterface $choiceList) { $this->choiceList = $choiceList; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php index 05da291733834..a6b2f3fd58cec 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php @@ -22,17 +22,12 @@ class ChoicesToValuesTransformer implements DataTransformerInterface { private $choiceList; - /** - * @param ChoiceListInterface $choiceList - */ public function __construct(ChoiceListInterface $choiceList) { $this->choiceList = $choiceList; } /** - * @param array $array - * * @return array * * @throws TransformationFailedException if the given value is not an array @@ -51,8 +46,6 @@ public function transform($array) } /** - * @param array $array - * * @return array * * @throws TransformationFailedException if the given value is not an array diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php index f52bb97eb40a0..81ffc7e247625 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php @@ -21,17 +21,12 @@ */ class DataTransformerChain implements DataTransformerInterface { - /** - * The value transformers. - * - * @var DataTransformerInterface[] - */ protected $transformers; /** * Uses the given value transformers to transform values. * - * @param array $transformers + * @param DataTransformerInterface[] $transformers */ public function __construct(array $transformers) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php index 2c1d6d0f62b88..5b851af7dd88e 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -47,8 +47,6 @@ public function transform($value) /** * Extracts the duplicated value from an array. * - * @param array $array - * * @return mixed The value * * @throws TransformationFailedException if the given value is not an array or diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php index 7f891304fbfb9..bdfeec9bd4a1e 100644 --- a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php +++ b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php @@ -24,35 +24,20 @@ */ class ResizeFormListener implements EventSubscriberInterface { - /** - * @var string - */ protected $type; - - /** - * @var array - */ protected $options; - - /** - * Whether children could be added to the group. - * - * @var bool - */ protected $allowAdd; - - /** - * Whether children could be removed from the group. - * - * @var bool - */ protected $allowDelete; - /** - * @var bool|callable - */ private $deleteEmpty; + /** + * @param string $type + * @param array $options + * @param bool $allowAdd whether children could be added to the group + * @param bool $allowDelete whether children could be removed from the group + * @param bool|callable $deleteEmpty + */ public function __construct($type, array $options = array(), $allowAdd = false, $allowDelete = false, $deleteEmpty = false) { $this->type = $type; diff --git a/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php b/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php index 0bd33d36a5d1f..c80dd67141a0e 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php @@ -49,8 +49,6 @@ public static function getSubscribedEvents() /** * Listener for the {@link FormEvents::POST_SET_DATA} event. - * - * @param FormEvent $event The event object */ public function postSetData(FormEvent $event) { @@ -65,8 +63,6 @@ public function postSetData(FormEvent $event) /** * Listener for the {@link FormEvents::POST_SUBMIT} event. - * - * @param FormEvent $event The event object */ public function postSubmit(FormEvent $event) { diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php index 078aed2e864cc..3fac07591db98 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php @@ -29,9 +29,6 @@ */ class FormDataCollector extends DataCollector implements FormDataCollectorInterface { - /** - * @var FormDataExtractor - */ private $dataExtractor; /** diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php index ee004a09f30b4..d2a7818cd0fe9 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php @@ -24,37 +24,26 @@ interface FormDataCollectorInterface extends DataCollectorInterface { /** * Stores configuration data of the given form and its children. - * - * @param FormInterface $form A root form */ public function collectConfiguration(FormInterface $form); /** * Stores the default data of the given form and its children. - * - * @param FormInterface $form A root form */ public function collectDefaultData(FormInterface $form); /** * Stores the submitted data of the given form and its children. - * - * @param FormInterface $form A root form */ public function collectSubmittedData(FormInterface $form); /** * Stores the view variables of the given form view and its children. - * - * @param FormView $view A root form view */ public function collectViewVariables(FormView $view); /** * Specifies that the given objects represent the same conceptual form. - * - * @param FormInterface $form A form object - * @param FormView $view A view object */ public function associateFormWithView(FormInterface $form, FormView $view); @@ -63,8 +52,6 @@ public function associateFormWithView(FormInterface $form, FormView $view); * a tree-like data structure. * * The result can be queried using {@link getData()}. - * - * @param FormInterface $form A root form */ public function buildPreliminaryFormTree(FormInterface $form); @@ -85,9 +72,6 @@ public function buildPreliminaryFormTree(FormInterface $form); * tree, only the view data will be included in the result. If a * corresponding {@link FormInterface} exists otherwise, call * {@link associateFormWithView()} before calling this method. - * - * @param FormInterface $form A root form - * @param FormView $view A root view */ public function buildFinalFormTree(FormInterface $form, FormView $view); diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php index 355f4d13577c7..9e7a9b579ea30 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php @@ -155,8 +155,6 @@ public function extractViewVariables(FormView $view) /** * Recursively builds an HTML ID for a form. * - * @param FormInterface $form The form - * * @return string The HTML ID */ private function buildId(FormInterface $form) diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php index e0bc6dc0caccc..5fd345fec0025 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php @@ -24,8 +24,6 @@ interface FormDataExtractorInterface /** * Extracts the configuration data of a form. * - * @param FormInterface $form The form - * * @return array Information about the form's configuration */ public function extractConfiguration(FormInterface $form); @@ -33,8 +31,6 @@ public function extractConfiguration(FormInterface $form); /** * Extracts the default data of a form. * - * @param FormInterface $form The form - * * @return array Information about the form's default data */ public function extractDefaultData(FormInterface $form); @@ -42,8 +38,6 @@ public function extractDefaultData(FormInterface $form); /** * Extracts the submitted data of a form. * - * @param FormInterface $form The form - * * @return array Information about the form's submitted data */ public function extractSubmittedData(FormInterface $form); @@ -51,8 +45,6 @@ public function extractSubmittedData(FormInterface $form); /** * Extracts the view variables of a form. * - * @param FormView $view The form view - * * @return array Information about the view's variables */ public function extractViewVariables(FormView $view); diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php index 93ef583a96134..d0f257a83dc9f 100644 --- a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php +++ b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php @@ -21,14 +21,8 @@ */ class FormTypeHttpFoundationExtension extends AbstractTypeExtension { - /** - * @var RequestHandlerInterface - */ private $requestHandler; - /** - * @param RequestHandlerInterface $requestHandler - */ public function __construct(RequestHandlerInterface $requestHandler = null) { $this->requestHandler = $requestHandler ?: new HttpFoundationRequestHandler(); diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index b6951a9407e64..ae6afadaab94a 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -135,8 +135,6 @@ public function validate($form, Constraint $constraint) /** * Returns the validation groups of the given form. * - * @param FormInterface $form The form - * * @return array The validation groups */ private static function getValidationGroups(FormInterface $form) diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index 2adcc0cf13c1f..3b809a2e21786 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -73,8 +73,6 @@ public function guessPattern($class, $property) /** * Guesses a field class name for a given constraint. * - * @param Constraint $constraint The constraint to guess for - * * @return TypeGuess|null The guessed field class and options */ public function guessTypeForConstraint(Constraint $constraint) @@ -160,8 +158,6 @@ public function guessTypeForConstraint(Constraint $constraint) /** * Guesses whether a field is required based on the given constraint. * - * @param Constraint $constraint The constraint to guess for - * * @return ValueGuess|null The guess whether the field is required */ public function guessRequiredForConstraint(Constraint $constraint) @@ -177,8 +173,6 @@ public function guessRequiredForConstraint(Constraint $constraint) /** * Guesses a field's maximum length based on the given constraint. * - * @param Constraint $constraint The constraint to guess for - * * @return ValueGuess|null The guess for the maximum length */ public function guessMaxLengthForConstraint(Constraint $constraint) @@ -207,8 +201,6 @@ public function guessMaxLengthForConstraint(Constraint $constraint) /** * Guesses a field's pattern based on the given constraint. * - * @param Constraint $constraint The constraint to guess for - * * @return ValueGuess|null The guess for the pattern */ public function guessPatternForConstraint(Constraint $constraint) diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php index 14e7b521f17e8..8a3602e701c3a 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php @@ -269,8 +269,6 @@ private function reconstructPath(ViolationPath $violationPath, FormInterface $or } /** - * @param FormInterface $form - * * @return bool */ private function acceptsErrors(FormInterface $form) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 50a6a3e488ddc..7563d833167b8 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -161,8 +161,6 @@ class Form implements \IteratorAggregate, FormInterface /** * Creates a new form based on the given configuration. * - * @param FormConfigInterface $config The form configuration - * * @throws LogicException if a data mapper is not provided for a compound form */ public function __construct(FormConfigInterface $config) diff --git a/src/Symfony/Component/Form/FormConfigBuilderInterface.php b/src/Symfony/Component/Form/FormConfigBuilderInterface.php index 3cb4e384824de..bd9e8d8de7107 100644 --- a/src/Symfony/Component/Form/FormConfigBuilderInterface.php +++ b/src/Symfony/Component/Form/FormConfigBuilderInterface.php @@ -35,8 +35,6 @@ public function addEventListener($eventName, $listener, $priority = 0); /** * Adds an event subscriber for events on this form. * - * @param EventSubscriberInterface $subscriber The subscriber to attach - * * @return $this The configuration object */ public function addEventSubscriber(EventSubscriberInterface $subscriber); @@ -98,8 +96,6 @@ public function setAttribute($name, $value); /** * Sets the attributes. * - * @param array $attributes The attributes - * * @return $this The configuration object */ public function setAttributes(array $attributes); @@ -107,8 +103,6 @@ public function setAttributes(array $attributes); /** * Sets the data mapper used by the form. * - * @param DataMapperInterface $dataMapper - * * @return $this The configuration object */ public function setDataMapper(DataMapperInterface $dataMapper = null); @@ -202,8 +196,6 @@ public function setCompound($compound); /** * Set the types. * - * @param ResolvedFormTypeInterface $type The type of the form - * * @return $this The configuration object */ public function setType(ResolvedFormTypeInterface $type); @@ -232,8 +224,6 @@ public function setDataLocked($locked); /** * Sets the form factory used for creating new forms. - * - * @param FormFactoryInterface $formFactory The form factory */ public function setFormFactory(FormFactoryInterface $formFactory); @@ -258,8 +248,6 @@ public function setMethod($method); /** * Sets the request handler used by the form. * - * @param RequestHandlerInterface $requestHandler - * * @return $this The configuration object */ public function setRequestHandler(RequestHandlerInterface $requestHandler); diff --git a/src/Symfony/Component/Form/FormError.php b/src/Symfony/Component/Form/FormError.php index a74b5ae80c7a5..e05ee5bc84b6d 100644 --- a/src/Symfony/Component/Form/FormError.php +++ b/src/Symfony/Component/Form/FormError.php @@ -20,37 +20,11 @@ */ class FormError implements \Serializable { - /** - * @var string - */ - private $message; - - /** - * The template for the error message. - * - * @var string - */ protected $messageTemplate; - - /** - * The parameters that should be substituted in the message template. - * - * @var array - */ protected $messageParameters; - - /** - * The value for error message pluralization. - * - * @var int|null - */ protected $messagePluralization; - /** - * The cause for this error. - * - * @var mixed - */ + private $message; private $cause; /** diff --git a/src/Symfony/Component/Form/FormEvents.php b/src/Symfony/Component/Form/FormEvents.php index b795f95dcfafc..c9b01736d495f 100644 --- a/src/Symfony/Component/Form/FormEvents.php +++ b/src/Symfony/Component/Form/FormEvents.php @@ -31,7 +31,7 @@ final class FormEvents * * @Event("Symfony\Component\Form\FormEvent") */ - const PRE_SUBMIT = 'form.pre_bind'; + const PRE_SUBMIT = 'form.pre_submit'; /** * The SUBMIT event is dispatched just before the Form::submit() method @@ -41,7 +41,7 @@ final class FormEvents * * @Event("Symfony\Component\Form\FormEvent") */ - const SUBMIT = 'form.bind'; + const SUBMIT = 'form.submit'; /** * The FormEvents::POST_SUBMIT event is dispatched after the Form::submit() @@ -51,7 +51,7 @@ final class FormEvents * * @Event("Symfony\Component\Form\FormEvent") */ - const POST_SUBMIT = 'form.post_bind'; + const POST_SUBMIT = 'form.post_submit'; /** * The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method. diff --git a/src/Symfony/Component/Form/FormFactoryBuilderInterface.php b/src/Symfony/Component/Form/FormFactoryBuilderInterface.php index c1e55dcc60ea5..35cdc44d9d43f 100644 --- a/src/Symfony/Component/Form/FormFactoryBuilderInterface.php +++ b/src/Symfony/Component/Form/FormFactoryBuilderInterface.php @@ -21,8 +21,6 @@ interface FormFactoryBuilderInterface /** * Sets the factory for creating ResolvedFormTypeInterface instances. * - * @param ResolvedFormTypeFactoryInterface $resolvedTypeFactory - * * @return $this */ public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory); @@ -30,8 +28,6 @@ public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolve /** * Adds an extension to be loaded by the factory. * - * @param FormExtensionInterface $extension The extension - * * @return $this */ public function addExtension(FormExtensionInterface $extension); @@ -48,8 +44,6 @@ public function addExtensions(array $extensions); /** * Adds a form type to the factory. * - * @param FormTypeInterface $type The form type - * * @return $this */ public function addType(FormTypeInterface $type); @@ -66,8 +60,6 @@ public function addTypes(array $types); /** * Adds a form type extension to the factory. * - * @param FormTypeExtensionInterface $typeExtension The form type extension - * * @return $this */ public function addTypeExtension(FormTypeExtensionInterface $typeExtension); @@ -84,8 +76,6 @@ public function addTypeExtensions(array $typeExtensions); /** * Adds a type guesser to the factory. * - * @param FormTypeGuesserInterface $typeGuesser The type guesser - * * @return $this */ public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser); diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index 5444ff916a7f5..d53e3502e3268 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -23,8 +23,6 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable /** * Sets the parent form. * - * @param FormInterface|null $parent The parent form or null if it's the root - * * @return self * * @throws Exception\AlreadySubmittedException if the form has already been submitted @@ -296,8 +294,6 @@ public function isRoot(); /** * Creates a view. * - * @param FormView $parent The parent view - * * @return FormView The view */ public function createView(FormView $parent = null); diff --git a/src/Symfony/Component/Form/FormRenderer.php b/src/Symfony/Component/Form/FormRenderer.php index c8a9d1812eb8b..40cdea3695a32 100644 --- a/src/Symfony/Component/Form/FormRenderer.php +++ b/src/Symfony/Component/Form/FormRenderer.php @@ -24,35 +24,12 @@ class FormRenderer implements FormRendererInterface { const CACHE_KEY_VAR = 'unique_block_prefix'; - /** - * @var FormRendererEngineInterface - */ private $engine; - - /** - * @var CsrfTokenManagerInterface - */ private $csrfTokenManager; - - /** - * @var array - */ private $blockNameHierarchyMap = array(); - - /** - * @var array - */ private $hierarchyLevelMap = array(); - - /** - * @var array - */ private $variableStack = array(); - /** - * @param FormRendererEngineInterface $engine - * @param CsrfTokenManagerInterface|null $csrfTokenManager - */ public function __construct(FormRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null) { $this->engine = $engine; @@ -70,10 +47,9 @@ public function getEngine() /** * {@inheritdoc} */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */) + public function setTheme(FormView $view, $themes, $useDefaultThemes = true) { - $args = func_get_args(); - $this->engine->setTheme($view, $themes, isset($args[2]) ? (bool) $args[2] : true); + $this->engine->setTheme($view, $themes, $useDefaultThemes); } /** diff --git a/src/Symfony/Component/Form/FormRendererEngineInterface.php b/src/Symfony/Component/Form/FormRendererEngineInterface.php index dcc15b6a2450f..fd8f6b4023220 100644 --- a/src/Symfony/Component/Form/FormRendererEngineInterface.php +++ b/src/Symfony/Component/Form/FormRendererEngineInterface.php @@ -25,9 +25,9 @@ interface FormRendererEngineInterface * @param mixed $themes The theme(s). The type of these themes * is open to the implementation. * @param bool $useDefaultThemes If true, will use default themes specified - * in the engine, will be added to the interface in 4.0 + * in the engine */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */); + public function setTheme(FormView $view, $themes, $useDefaultThemes = true); /** * Returns the resource for a block name. diff --git a/src/Symfony/Component/Form/FormRendererInterface.php b/src/Symfony/Component/Form/FormRendererInterface.php index 33530aeb82c47..432892dbbc2ad 100644 --- a/src/Symfony/Component/Form/FormRendererInterface.php +++ b/src/Symfony/Component/Form/FormRendererInterface.php @@ -32,9 +32,9 @@ public function getEngine(); * @param mixed $themes The theme(s). The type of these themes * is open to the implementation. * @param bool $useDefaultThemes If true, will use default themes specified - * in the renderer, will be added to the interface in 4.0 + * in the renderer */ - public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */); + public function setTheme(FormView $view, $themes, $useDefaultThemes = true); /** * Renders a named block of the form theme. diff --git a/src/Symfony/Component/Form/FormTypeExtensionInterface.php b/src/Symfony/Component/Form/FormTypeExtensionInterface.php index fe2ebd4e37f9a..f7394a2999a11 100644 --- a/src/Symfony/Component/Form/FormTypeExtensionInterface.php +++ b/src/Symfony/Component/Form/FormTypeExtensionInterface.php @@ -25,9 +25,6 @@ interface FormTypeExtensionInterface * further modify it. * * @see FormTypeInterface::buildForm() - * - * @param FormBuilderInterface $builder The form builder - * @param array $options The options */ public function buildForm(FormBuilderInterface $builder, array $options); @@ -38,10 +35,6 @@ public function buildForm(FormBuilderInterface $builder, array $options); * further modify it. * * @see FormTypeInterface::buildView() - * - * @param FormView $view The view - * @param FormInterface $form The form - * @param array $options The options */ public function buildView(FormView $view, FormInterface $form, array $options); @@ -52,10 +45,6 @@ public function buildView(FormView $view, FormInterface $form, array $options); * further modify it. * * @see FormTypeInterface::finishView() - * - * @param FormView $view The view - * @param FormInterface $form The form - * @param array $options The options */ public function finishView(FormView $view, FormInterface $form, array $options); diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php index 8655bedf6e135..21a3d5036ad2b 100644 --- a/src/Symfony/Component/Form/FormView.php +++ b/src/Symfony/Component/Form/FormView.php @@ -20,8 +20,6 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable { /** * The variables assigned to this view. - * - * @var array */ public $vars = array( 'value' => null, @@ -30,8 +28,6 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable /** * The parent view. - * - * @var FormView */ public $parent; diff --git a/src/Symfony/Component/Form/Guess/TypeGuess.php b/src/Symfony/Component/Form/Guess/TypeGuess.php index a190d5bc03e12..1431b5e400569 100644 --- a/src/Symfony/Component/Form/Guess/TypeGuess.php +++ b/src/Symfony/Component/Form/Guess/TypeGuess.php @@ -19,18 +19,7 @@ */ class TypeGuess extends Guess { - /** - * The guessed field type. - * - * @var string - */ private $type; - - /** - * The guessed options for creating an instance of the guessed class. - * - * @var array - */ private $options; /** diff --git a/src/Symfony/Component/Form/NativeRequestHandler.php b/src/Symfony/Component/Form/NativeRequestHandler.php index 3607feb99cc98..e28c2b4b102cf 100644 --- a/src/Symfony/Component/Form/NativeRequestHandler.php +++ b/src/Symfony/Component/Form/NativeRequestHandler.php @@ -21,9 +21,6 @@ */ class NativeRequestHandler implements RequestHandlerInterface { - /** - * @var ServerParams - */ private $serverParams; /** @@ -36,8 +33,6 @@ public function __construct(ServerParams $params = null) /** * The allowed keys of the $_FILES array. - * - * @var array */ private static $fileKeys = array( 'error', @@ -159,8 +154,6 @@ private static function getRequestMethod() * This method is identical to {@link \Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray} * and should be kept as such in order to port fixes quickly and easily. * - * @param array $data - * * @return array */ private static function fixPhpFilesArray($data) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf index 4e2518b16b19c..2a5e57ca81b36 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf @@ -11,8 +11,8 @@ Den uppladdade filen var för stor. Försök ladda upp en mindre fil. - The CSRF token is invalid. - CSRF-symbolen är inte giltig. + The CSRF token is invalid. Please try to resubmit the form. + CSRF-elementet är inte giltigt. Försök att skicka formuläret igen. diff --git a/src/Symfony/Component/Form/ReversedTransformer.php b/src/Symfony/Component/Form/ReversedTransformer.php index fc5cd12bc37c2..8089e47bf0554 100644 --- a/src/Symfony/Component/Form/ReversedTransformer.php +++ b/src/Symfony/Component/Form/ReversedTransformer.php @@ -21,18 +21,8 @@ */ class ReversedTransformer implements DataTransformerInterface { - /** - * The reversed transformer. - * - * @var DataTransformerInterface - */ protected $reversedTransformer; - /** - * Reverses this transformer. - * - * @param DataTransformerInterface $reversedTransformer - */ public function __construct(DataTransformerInterface $reversedTransformer) { $this->reversedTransformer = $reversedTransformer; diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3HorizontalLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3HorizontalLayoutTest.php index 1273fa505bd2c..04b5b5836c650 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3HorizontalLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3HorizontalLayoutTest.php @@ -154,4 +154,13 @@ public function testStartTagWithExtraAttributes() $this->assertSame('
', $html); } + + public function testCheckboxRow() + { + $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType'); + $view = $form->createView(); + $html = $this->renderRow($view, array('label' => 'foo')); + + $this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2); + } } diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php index 990fffbe94689..2833de7d91de0 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php @@ -26,8 +26,8 @@ public function testLabelOnForm() $html = $this->renderLabel($view); $this->assertMatchesXpath($html, -'/label - [@class="col-form-label col-sm-2 form-control-label required"] +'/legend + [@class="col-form-label col-sm-2 col-form-legend required"] [.="[trans]Name[/trans]"] ' ); @@ -118,7 +118,7 @@ public function testLegendOnExpandedType() $this->assertMatchesXpath($html, '/legend - [@class="col-sm-2 col-form-legend form-control-label required"] + [@class="col-sm-2 col-form-legend required"] [.="[trans]Custom label[/trans]"] ' ); @@ -178,4 +178,13 @@ public function testStartTagWithExtraAttributes() $this->assertSame('', $html); } + + public function testCheckboxRow() + { + $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType'); + $view = $form->createView(); + $html = $this->renderRow($view, array('label' => 'foo')); + + $this->assertMatchesXpath($html, '/div[@class="form-group row"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2); + } } diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php index 35bd1203b3f80..84f93cc332037 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php @@ -28,8 +28,8 @@ public function testLabelOnForm() $html = $this->renderLabel($view); $this->assertMatchesXpath($html, -'/label - [@class="form-control-label required"] +'/legend + [@class="col-form-legend required"] [.="[trans]Name[/trans]"] ' ); @@ -120,7 +120,7 @@ public function testLegendOnExpandedType() $this->assertMatchesXpath($html, '/legend - [@class="col-form-legend form-control-label required"] + [@class="col-form-legend required"] [.="[trans]Custom label[/trans]"] ' ); diff --git a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php index 15df850796ae8..014a5ae179b13 100644 --- a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Form\ButtonBuilder; +use Symfony\Component\Form\Exception\InvalidArgumentException; /** * @author Alexander Cheprasov @@ -53,10 +54,12 @@ public function getInvalidNames() */ public function testInvalidNames($name) { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}( - '\Symfony\Component\Form\Exception\InvalidArgumentException', - 'Buttons cannot have empty names.' - ); + if (method_exists($this, 'expectException')) { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Buttons cannot have empty names.'); + } else { + $this->setExpectedException(InvalidArgumentException::class, 'Buttons cannot have empty names.'); + } new ButtonBuilder($name); } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php index 25ad31f8666b6..81e6b3bc6cf66 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php @@ -181,7 +181,12 @@ public function testReverseTransformWithEmptyFields() 'minutes' => '', 'seconds' => '6', ); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class, 'This amount of "minutes" is invalid'); + if (method_exists($this, 'expectException')) { + $this->expectException(TransformationFailedException::class); + $this->expectExceptionMessage('This amount of "minutes" is invalid'); + } else { + $this->setExpectedException(TransformationFailedException::class, 'This amount of "minutes" is invalid'); + } $transformer->reverseTransform($input); } @@ -191,7 +196,12 @@ public function testReverseTransformWithWrongInvertType() $input = array( 'invert' => '1', ); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class, 'The value of "invert" must be boolean'); + if (method_exists($this, 'expectException')) { + $this->expectException(TransformationFailedException::class); + $this->expectExceptionMessage('The value of "invert" must be boolean'); + } else { + $this->setExpectedException(TransformationFailedException::class, 'The value of "invert" must be boolean'); + } $transformer->reverseTransform($input); } diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php index 89735ea6180c6..fe922e9239faa 100644 --- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php +++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php @@ -56,6 +56,15 @@ public function testInsertNullKeys() $this->assertSame(array(0 => 1, 'foo' => 2, 1 => 3), iterator_to_array($map)); } + public function testInsertLooselyEqualKeys() + { + $map = new OrderedHashMap(); + $map['1 as a string'] = '1 as a string'; + $map[1] = 1; + + $this->assertSame(array('1 as a string' => '1 as a string', 1 => 1), iterator_to_array($map)); + } + /** * Updates should not change the position of an element, otherwise we could * turn foreach loops into endless loops if they change the current @@ -111,6 +120,17 @@ public function testUnset() $this->assertSame(array('second' => 2), iterator_to_array($map)); } + public function testUnsetFromLooselyEqualKeysHashMap() + { + $map = new OrderedHashMap(); + $map['1 as a string'] = '1 as a string'; + $map[1] = 1; + + unset($map[1]); + + $this->assertSame(array('1 as a string' => '1 as a string'), iterator_to_array($map)); + } + public function testUnsetNonExistingSucceeds() { $map = new OrderedHashMap(); diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php index 78687032feac6..24ec0d529902f 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMap.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php @@ -133,7 +133,7 @@ public function offsetSet($key, $value) : 1 + (int) max($this->orderedKeys); } - $this->orderedKeys[] = $key; + $this->orderedKeys[] = (string) $key; } $this->elements[$key] = $value; @@ -144,7 +144,7 @@ public function offsetSet($key, $value) */ public function offsetUnset($key) { - if (false !== ($position = array_search($key, $this->orderedKeys))) { + if (false !== ($position = array_search((string) $key, $this->orderedKeys))) { array_splice($this->orderedKeys, $position, 1); unset($this->elements[$key]); diff --git a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php index 7305f51640c38..11562475d822e 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php @@ -118,7 +118,13 @@ public function next() */ public function key() { - return $this->key; + if (null === $this->key) { + return null; + } + + $array = array($this->key => null); + + return key($array); } /** diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeader.php b/src/Symfony/Component/HttpFoundation/AcceptHeader.php index 99be6768f9b72..d1740266b7a80 100644 --- a/src/Symfony/Component/HttpFoundation/AcceptHeader.php +++ b/src/Symfony/Component/HttpFoundation/AcceptHeader.php @@ -97,8 +97,6 @@ public function get($value) /** * Adds an item. * - * @param AcceptHeaderItem $item - * * @return $this */ public function add(AcceptHeaderItem $item) @@ -153,7 +151,7 @@ public function first() private function sort() { if (!$this->sorted) { - uasort($this->items, function ($a, $b) { + uasort($this->items, function (AcceptHeaderItem $a, AcceptHeaderItem $b) { $qA = $a->getQuality(); $qB = $b->getQuality(); diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index 921751f6b5af5..263fb321c5745 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -65,8 +65,6 @@ private function __construct() * Registers a new extension guesser. * * When guessing, this guesser is preferred over previously registered ones. - * - * @param ExtensionGuesserInterface $guesser */ public function register(ExtensionGuesserInterface $guesser) { diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php index e327f834f78a4..896c135a53424 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -23,8 +23,6 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface * This list has been updated from upstream on 2013-04-23. * * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types - * - * @var array */ protected $defaultExtensions = array( 'application/andrew-inset' => 'ez', diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index 69c803b4993bc..e3ef45ef672cf 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -93,8 +93,6 @@ private function __construct() * Registers a new mime type guesser. * * When guessing, this guesser is preferred over previously registered ones. - * - * @param MimeTypeGuesserInterface $guesser */ public function register(MimeTypeGuesserInterface $guesser) { diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index 722ec2a9c4a92..5edd0e6210c52 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -87,7 +87,10 @@ protected function convertFileInformation($file) $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); } } else { - $file = array_filter(array_map(array($this, 'convertFileInformation'), $file)); + $file = array_map(array($this, 'convertFileInformation'), $file); + if (array_keys($keys) === $keys) { + $file = array_filter($file); + } } } @@ -106,8 +109,6 @@ protected function convertFileInformation($file) * It's safe to pass an already converted array, in which case this method * just returns the original array unmodified. * - * @param array $data - * * @return array */ protected function fixPhpFilesArray($data) diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 3d278914e6f09..257ef8bceaa43 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -20,8 +20,6 @@ class ParameterBag implements \IteratorAggregate, \Countable { /** * Parameter storage. - * - * @var array */ protected $parameters; diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php index cb1c58e8999a5..01681dcdf787a 100644 --- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -48,7 +48,13 @@ public function __construct($url, $status = 302, $headers = array()) } /** - * {@inheritdoc} + * Factory method for chainability. + * + * @param string $url The url to redirect to + * @param int $status The response status code + * @param array $headers An array of response headers + * + * @return static */ public static function create($url = '', $status = 302, $headers = array()) { diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ac9dd0d61c6f1..b3e2badd9e424 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -116,7 +116,7 @@ class Request public $headers; /** - * @var string + * @var string|resource */ protected $content; @@ -193,7 +193,6 @@ class Request protected static $requestFactory; private $isHostValid = true; - private $isClientIpsValid = true; private $isForwardedValid = true; private static $trustedHeaderSet = -1; @@ -1749,6 +1748,9 @@ protected function prepareBaseUrl() // Does the baseUrl have anything in common with the request_uri? $requestUri = $this->getRequestUri(); + if ($requestUri !== '' && $requestUri[0] !== '/') { + $requestUri = '/'.$requestUri; + } if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) { // full $baseUrl matches @@ -1821,9 +1823,12 @@ protected function preparePathInfo() } // Remove the query string from REQUEST_URI - if ($pos = strpos($requestUri, '?')) { + if (false !== $pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); } + if ($requestUri !== '' && $requestUri[0] !== '/') { + $requestUri = '/'.$requestUri; + } $pathInfo = substr($requestUri, strlen($baseUrl)); if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) { diff --git a/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php index 066e7e8bf1dee..c26db3e6f4e66 100644 --- a/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php +++ b/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php @@ -21,8 +21,6 @@ interface RequestMatcherInterface /** * Decides whether the rule(s) implemented by the strategy matches the supplied request. * - * @param Request $request The request to check for a match - * * @return bool true if the request matches, false otherwise */ public function matches(Request $request); diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 7d63fe9abaa4e..28738a2dcb58a 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -254,8 +254,6 @@ public function __clone() * compliant with RFC 2616. Most of the changes are based on * the Request that is "associated" with this Response. * - * @param Request $request A Request instance - * * @return $this */ public function prepare(Request $request) @@ -614,6 +612,8 @@ public function setPublic() * @param bool $immutable enables or disables the immutable directive * * @return $this + * + * @final */ public function setImmutable($immutable = true) { @@ -630,6 +630,8 @@ public function setImmutable($immutable = true) * Returns true if the response is marked as "immutable". * * @return bool returns true if the response is marked as "immutable"; otherwise false + * + * @final */ public function isImmutable() { @@ -670,15 +672,17 @@ public function getDate() /** * Sets the Date header. * - * @param \DateTime $date A \DateTime instance - * * @return $this * * @final since version 3.2 */ - public function setDate(\DateTime $date) + public function setDate(\DateTimeInterface $date) { - $date->setTimezone(new \DateTimeZone('UTC')); + if ($date instanceof \DateTime) { + $date = \DateTimeImmutable::createFromMutable($date); + } + + $date = $date->setTimezone(new \DateTimeZone('UTC')); $this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT'); return $this; @@ -736,22 +740,27 @@ public function getExpires() * * Passing null as value will remove the header. * - * @param \DateTime|null $date A \DateTime instance or null to remove the header + * @param \DateTimeInterface|null $date A \DateTime instance or null to remove the header * * @return $this * * @final since version 3.2 */ - public function setExpires(\DateTime $date = null) + public function setExpires(\DateTimeInterface $date = null) { if (null === $date) { $this->headers->remove('Expires'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT'); + + return $this; } + if ($date instanceof \DateTime) { + $date = \DateTimeImmutable::createFromMutable($date); + } + + $date = $date->setTimezone(new \DateTimeZone('UTC')); + $this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT'); + return $this; } @@ -892,22 +901,27 @@ public function getLastModified() * * Passing null as value will remove the header. * - * @param \DateTime|null $date A \DateTime instance or null to remove the header + * @param \DateTimeInterface|null $date A \DateTime instance or null to remove the header * * @return $this * * @final since version 3.2 */ - public function setLastModified(\DateTime $date = null) + public function setLastModified(\DateTimeInterface $date = null) { if (null === $date) { $this->headers->remove('Last-Modified'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); + + return $this; } + if ($date instanceof \DateTime) { + $date = \DateTimeImmutable::createFromMutable($date); + } + + $date = $date->setTimezone(new \DateTimeZone('UTC')); + $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); + return $this; } @@ -1088,8 +1102,6 @@ public function setVary($headers, $replace = true) * If the Response is not modified, it sets the status code to 304 and * removes the actual content by calling the setNotModified() method. * - * @param Request $request A Request instance - * * @return bool true if the Response validators match the Request, false otherwise * * @final since version 3.3 diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index d48286e5757b5..df995cf74edad 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -24,24 +24,10 @@ class ResponseHeaderBag extends HeaderBag const DISPOSITION_ATTACHMENT = 'attachment'; const DISPOSITION_INLINE = 'inline'; - /** - * @var array - */ protected $computedCacheControl = array(); - - /** - * @var array - */ protected $cookies = array(); - - /** - * @var array - */ protected $headerNames = array(); - /** - * @param array $headers An array of HTTP headers - */ public function __construct(array $headers = array()) { parent::__construct($headers); @@ -185,11 +171,6 @@ public function getCacheControlDirective($key) return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; } - /** - * Sets a cookie. - * - * @param Cookie $cookie - */ public function setCookie(Cookie $cookie) { $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; diff --git a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php index 57c297197b862..ea1fda290fdfe 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php @@ -17,15 +17,8 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable { private $name = 'attributes'; - - /** - * @var string - */ private $storageKey; - /** - * @var array - */ protected $attributes = array(); /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php index 6711bc3e31886..811908b2fdf08 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php @@ -19,19 +19,7 @@ class AutoExpireFlashBag implements FlashBagInterface { private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ private $flashes = array('display' => array(), 'new' => array()); - - /** - * The storage key for flashes in the session. - * - * @var string - */ private $storageKey; /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php index 3dc9fe052d95f..12fb740c5220c 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php @@ -19,19 +19,7 @@ class FlashBag implements FlashBagInterface { private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ private $flashes = array(); - - /** - * The storage key for flashes in the session. - * - * @var string - */ private $storageKey; /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php index 25f3d57b5417b..80e97f17cdff3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php @@ -72,8 +72,6 @@ public function all(); /** * Sets all flash messages. - * - * @param array $messages */ public function setAll(array $messages); diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php b/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php index aca18aacbf89f..8e37d06d65da3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php @@ -27,8 +27,6 @@ public function getName(); /** * Initializes the Bag. - * - * @param array $array */ public function initialize(array &$array); diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php index 172c9b457fb15..95fca857e2430 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -159,8 +159,6 @@ public function isStarted(); /** * Registers a SessionBagInterface with the session. - * - * @param SessionBagInterface $bag */ public function registerBag(SessionBagInterface $bag); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php index c20a23b20e5d9..0929c4d0e3d57 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -88,9 +88,6 @@ public function read($sessionId) $data = $this->doRead($sessionId); $this->newSessionId = '' === $data ? $sessionId : null; - if (\PHP_VERSION_ID < 70000) { - $this->prefetchData = $data; - } return $data; } @@ -100,14 +97,6 @@ public function read($sessionId) */ public function write($sessionId, $data) { - if (\PHP_VERSION_ID < 70000 && $this->prefetchData) { - $readData = $this->prefetchData; - $this->prefetchData = null; - - if ($readData === $data) { - return $this->updateTimestamp($sessionId, $data); - } - } if (null === $this->igbinaryEmptyData) { // see https://github.com/igbinary/igbinary/issues/146 $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : ''; @@ -125,9 +114,6 @@ public function write($sessionId, $data) */ public function destroy($sessionId) { - if (\PHP_VERSION_ID < 70000) { - $this->prefetchData = null; - } if (!headers_sent() && ini_get('session.use_cookies')) { if (!$this->sessionName) { throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', get_class($this))); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 19bf6e9bcaeef..bccfbf611f0db 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -413,7 +413,7 @@ public function close() $this->gcCalled = false; // delete the session records that have expired - $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time"; + $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol"; $stmt = $this->pdo->prepare($sql); $stmt->bindValue(':time', time(), \PDO::PARAM_INT); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 0349a43367d76..027f4efffce51 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -72,11 +72,6 @@ public function __construct($name = 'MOCKSESSID', MetadataBag $metaBag = null) $this->setMetadataBag($metaBag); } - /** - * Sets the session data. - * - * @param array $array - */ public function setSessionData(array $array) { $this->data = $array; @@ -213,11 +208,6 @@ public function isStarted() return $this->started; } - /** - * Sets the MetadataBag. - * - * @param MetadataBag $bag - */ public function setMetadataBag(MetadataBag $bag = null) { if (null === $bag) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 338a4f53f1aeb..b1d5b11f4860d 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -60,7 +60,8 @@ class NativeSessionStorage implements SessionStorageInterface * ("auto_start", is not supported as it tells PHP to start a session before * PHP starts to execute user-land code. Setting during runtime has no effect). * - * cache_limiter, "" (use "0" to prevent headers from being sent entirely). + * cache_limiter, "private_no_expire" (use "0" to prevent headers from being sent entirely). + * cache_expire, "0" * cookie_domain, "" * cookie_httponly, "" * cookie_lifetime, "0" @@ -97,6 +98,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB { $options += array( 'cache_limiter' => 'private_no_expire', + 'cache_expire' => 0, 'use_cookies' => 1, 'lazy_write' => 1, 'use_strict_mode' => 1, @@ -300,11 +302,6 @@ public function getBag($name) return $this->bags[$name]; } - /** - * Sets the MetadataBag. - * - * @param MetadataBag $metaBag - */ public function setMetadataBag(MetadataBag $metaBag = null) { if (null === $metaBag) { @@ -349,7 +346,7 @@ public function setOptions(array $options) } $validOptions = array_flip(array( - 'cache_limiter', 'cookie_domain', 'cookie_httponly', + 'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'lazy_write', 'name', 'referer_check', @@ -423,8 +420,6 @@ public function setSaveHandler($saveHandler = null) * are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). * PHP takes the return value from the read() handler, unserializes it * and populates $_SESSION with the result automatically. - * - * @param array|null $session */ protected function loadSession(array &$session = null) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 097583d5a51eb..66e8b33dd2bed 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -127,8 +127,6 @@ public function getBag($name); /** * Registers a SessionBagInterface for use. - * - * @param SessionBagInterface $bag */ public function registerBag(SessionBagInterface $bag); diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 329cea12dd7f0..92868d33e4814 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -84,7 +84,7 @@ public function setCallback(callable $callback) public function sendHeaders() { if ($this->headersSent) { - return; + return $this; } $this->headersSent = true; @@ -102,7 +102,7 @@ public function sendHeaders() public function sendContent() { if ($this->streamed) { - return; + return $this; } $this->streamed = true; diff --git a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php index 7d2902d325d46..b1bbba0d3f57c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php @@ -62,7 +62,7 @@ public function testShouldSetEmptyUploadedFilesToNull() public function testShouldRemoveEmptyUploadedFilesForMultiUpload() { - $bag = new FileBag(array('file' => array( + $bag = new FileBag(array('files' => array( 'name' => array(''), 'type' => array(''), 'tmp_name' => array(''), @@ -70,7 +70,20 @@ public function testShouldRemoveEmptyUploadedFilesForMultiUpload() 'size' => array(0), ))); - $this->assertSame(array(), $bag->get('file')); + $this->assertSame(array(), $bag->get('files')); + } + + public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray() + { + $bag = new FileBag(array('files' => array( + 'name' => array('file1' => ''), + 'type' => array('file1' => ''), + 'tmp_name' => array('file1' => ''), + 'error' => array('file1' => UPLOAD_ERR_NO_FILE), + 'size' => array('file1' => 0), + ))); + + $this->assertSame(array('file1' => null), $bag->get('files')); } public function testShouldConvertUploadedFilesWithPhpBug() diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index f5b2c17040d16..b9d7e313ec745 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1270,6 +1270,12 @@ public function testGetPathInfo() $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/path%20test/info', $request->getPathInfo()); + + $server = array(); + $server['REQUEST_URI'] = '?a=b'; + $request->initialize(array(), array(), array(), array(), array(), $server); + + $this->assertEquals('/', $request->getPathInfo()); } public function testGetParameterPrecedence() @@ -2079,6 +2085,61 @@ public function protocolVersionProvider() 'trusted with partially-broken via' => array('HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'), ); } + + public function nonstandardRequestsData() + { + return array( + array('', '', '/', 'http://host:8080/', ''), + array('/', '', '/', 'http://host:8080/', ''), + + array('hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), + array('/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), + + array('', 'a=b', '/', 'http://host:8080/?a=b'), + array('?a=b', 'a=b', '/', 'http://host:8080/?a=b'), + array('/?a=b', 'a=b', '/', 'http://host:8080/?a=b'), + + array('x', 'a=b', '/x', 'http://host:8080/x?a=b'), + array('x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), + array('/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), + + array('hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), + array('/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), + + array('hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), + array('hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), + array('/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), + ); + } + + /** + * @dataProvider nonstandardRequestsData + */ + public function testNonstandardRequests($requestUri, $queryString, $expectedPathInfo, $expectedUri, $expectedBasePath = '', $expectedBaseUrl = null) + { + if (null === $expectedBaseUrl) { + $expectedBaseUrl = $expectedBasePath; + } + + $server = array( + 'HTTP_HOST' => 'host:8080', + 'SERVER_PORT' => '8080', + 'QUERY_STRING' => $queryString, + 'PHP_SELF' => '/hello/app.php', + 'SCRIPT_FILENAME' => '/some/path/app.php', + 'REQUEST_URI' => $requestUri, + ); + + $request = new Request(array(), array(), array(), array(), array(), $server); + + $this->assertEquals($expectedPathInfo, $request->getPathInfo()); + $this->assertEquals($expectedUri, $request->getUri()); + $this->assertEquals($queryString, $request->getQueryString()); + $this->assertEquals(8080, $request->getPort()); + $this->assertEquals('host:8080', $request->getHttpHost()); + $this->assertEquals($expectedBaseUrl, $request->getBaseUrl()); + $this->assertEquals($expectedBasePath, $request->getBasePath()); + } } class RequestContentProxy extends Request diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 9c5b34febfa30..4f7dc2817a1b9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -653,6 +653,22 @@ public function testIsImmutable() $this->assertTrue($response->isImmutable()); } + public function testSetDate() + { + $response = new Response(); + $response->setDate(\DateTime::createFromFormat(\DateTime::ATOM, '2013-01-26T09:21:56+0100', new \DateTimeZone('Europe/Berlin'))); + + $this->assertEquals('2013-01-26T08:21:56+00:00', $response->getDate()->format(\DateTime::ATOM)); + } + + public function testSetDateWithImmutable() + { + $response = new Response(); + $response->setDate(\DateTimeImmutable::createFromFormat(\DateTime::ATOM, '2013-01-26T09:21:56+0100', new \DateTimeZone('Europe/Berlin'))); + + $this->assertEquals('2013-01-26T08:21:56+00:00', $response->getDate()->format(\DateTime::ATOM)); + } + public function testSetExpires() { $response = new Response(); @@ -666,6 +682,16 @@ public function testSetExpires() $this->assertEquals($response->getExpires()->getTimestamp(), $now->getTimestamp()); } + public function testSetExpiresWithImmutable() + { + $response = new Response(); + + $now = $this->createDateTimeImmutableNow(); + $response->setExpires($now); + + $this->assertEquals($response->getExpires()->getTimestamp(), $now->getTimestamp()); + } + public function testSetLastModified() { $response = new Response(); @@ -676,6 +702,16 @@ public function testSetLastModified() $this->assertNull($response->getLastModified()); } + public function testSetLastModifiedWithImmutable() + { + $response = new Response(); + $response->setLastModified($this->createDateTimeImmutableNow()); + $this->assertNotNull($response->getLastModified()); + + $response->setLastModified(null); + $this->assertNull($response->getLastModified()); + } + public function testIsInvalid() { $response = new Response(); @@ -912,6 +948,13 @@ protected function createDateTimeNow() return $date->setTimestamp(time()); } + protected function createDateTimeImmutableNow() + { + $date = new \DateTimeImmutable(); + + return $date->setTimestamp(time()); + } + protected function provideResponse() { return new Response(); @@ -990,14 +1033,3 @@ public function __toString() class DefaultResponse extends Response { } - -class ExtendedResponse extends Response -{ - public function setLastModified(\DateTime $date = null) - { - } - - public function getDate() - { - } -} diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index 8c148b58f06c8..655c26a9c24ce 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -21,10 +21,7 @@ */ class AttributeBagTest extends TestCase { - /** - * @var array - */ - private $array; + private $array = array(); /** * @var AttributeBag diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php index d9d9eb7fbee77..f074ce1b26261 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php @@ -21,10 +21,7 @@ */ class NamespacedAttributeBagTest extends TestCase { - /** - * @var array - */ - private $array; + private $array = array(); /** * @var NamespacedAttributeBag diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index c25befc4c3fd4..a4d176a100d9e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -26,9 +26,6 @@ class AutoExpireFlashBagTest extends TestCase */ private $bag; - /** - * @var array - */ protected $array = array(); protected function setUp() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index 07d17888070bf..c4e75b1b18b40 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -26,9 +26,6 @@ class FlashBagTest extends TestCase */ private $bag; - /** - * @var array - */ protected $array = array(); protected function setUp() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php index 3ac081e3884c1..6566d6eee4f7a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php @@ -13,9 +13,6 @@ use PHPUnit\Framework\TestCase; -/** - * @requires PHP 7.0 - */ class AbstractSessionHandlerTest extends TestCase { private static $server; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected index 5e8deb557c5c1..3bc9beeb758f1 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected @@ -15,6 +15,6 @@ $_SESSION is not empty Array ( [0] => Content-Type: text/plain; charset=utf-8 - [1] => Cache-Control: private, max-age=10800 + [1] => Cache-Control: private, max-age=0 ) shutdown diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php index 159e62114e1a3..69cf6163c16f3 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php @@ -26,9 +26,6 @@ class MetadataBagTest extends TestCase */ protected $bag; - /** - * @var array - */ protected $array = array(); protected function setUp() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 93de175fd3c67..e5b080d8a48d0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -54,8 +54,6 @@ protected function tearDown() } /** - * @param array $options - * * @return NativeSessionStorage */ protected function getStorage(array $options = array()) diff --git a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php index 1e35eb88b91fa..c2ded996fab4f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php @@ -112,4 +112,15 @@ public function testCreate() $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); $this->assertEquals(204, $response->getStatusCode()); } + + public function testReturnThis() + { + $response = new StreamedResponse(function () {}); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendContent()); + + $response = new StreamedResponse(function () {}); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); + } } diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 4cc4a2a24516b..46a0c893d8df0 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -53,8 +53,6 @@ public function shutdown() * * This method can be overridden to register compilation passes, * other extensions, ... - * - * @param ContainerBuilder $container A ContainerBuilder instance */ public function build(ContainerBuilder $container) { @@ -142,11 +140,6 @@ final public function getName() return $this->name; } - /** - * Registers console commands. - * - * @param Application $application An Application instance - */ public function registerCommands(Application $application) { } diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 1d58422527feb..88a95d8332942 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -36,8 +36,6 @@ public function shutdown(); * Builds the bundle. * * It is only ever called once when the cache is empty. - * - * @param ContainerBuilder $container A ContainerBuilder instance */ public function build(ContainerBuilder $container); diff --git a/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php b/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php index 215f5678c7afa..e028c3ea43f51 100644 --- a/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php +++ b/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php @@ -23,8 +23,6 @@ class ChainCacheClearer implements CacheClearerInterface private $clearers; /** - * Constructs a new instance of ChainCacheClearer. - * * @param array $clearers The initial clearers */ public function __construct(iterable $clearers = array()) diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index f9b2e794ccd0e..d682ff72fafb6 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -61,8 +61,6 @@ public function catchExceptions($catchExceptions) /** * Makes a request. * - * @param Request $request A Request instance - * * @return Response A Response instance */ protected function doRequest($request) @@ -79,8 +77,6 @@ protected function doRequest($request) /** * Returns the script to execute when the request must be insulated. * - * @param Request $request A Request instance - * * @return string */ protected function getScript($request) @@ -134,8 +130,6 @@ protected function getHandleScript() /** * Converts the BrowserKit request to a HttpKernel request. * - * @param DomRequest $request A DomRequest instance - * * @return Request A Request instance */ protected function filterRequest(DomRequest $request) @@ -160,8 +154,6 @@ protected function filterRequest(DomRequest $request) * * @see UploadedFile * - * @param array $files An array of files - * * @return array An array with all uploaded files marked as already moved */ protected function filterFiles(array $files) @@ -199,8 +191,6 @@ protected function filterFiles(array $files) /** * Converts the HttpKernel response to a BrowserKit response. * - * @param Response $response A Response instance - * * @return DomResponse A DomResponse instance */ protected function filterResponse($response) diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index 2ad0efe6e3c3e..4d4d5ac129dd6 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -132,7 +132,7 @@ private function getControllerError($callable) } if (2 !== count($callable)) { - return sprintf('Invalid format for controller, expected array(controller, method) or controller::method.'); + return 'Invalid format for controller, expected array(controller, method) or controller::method.'; } list($controller, $method) = $callable; diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php index ee2028c33d4b9..30b73f6b53b9e 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php @@ -34,8 +34,6 @@ interface ControllerResolverInterface * The resolver must only throw an exception when it should be able to load * controller but cannot because of some errors made by the developer. * - * @param Request $request A Request instance - * * @return callable|false A PHP callable representing the Controller, * or false if this resolver is not able to determine the controller * diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 0a6aa82b263bd..5675f073639a6 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -43,8 +43,6 @@ public function __construct($name = null, $version = null) /** * Sets the Kernel associated with this Request. - * - * @param KernelInterface $kernel A KernelInterface instance */ public function setKernel(KernelInterface $kernel = null) { diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php index 9e76a99fc52ff..549fd5d3a95f5 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php @@ -23,10 +23,6 @@ interface DataCollectorInterface { /** * Collects data for the given Request and Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An Exception instance */ public function collect(Request $request, Response $response, \Exception $exception = null); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php index 59f77c4ba29d8..afd34f8af814b 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php @@ -68,8 +68,6 @@ protected function guessRoute(Request $request, $controller) /** * Remembers the controller associated to each request. - * - * @param FilterControllerEvent $event The filter controller event */ public function onKernelController(FilterControllerEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php b/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php index c7eca3063c610..072c35f1c1cc6 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php @@ -37,9 +37,6 @@ final public function load(array $configs, ContainerBuilder $container) /** * Configures the passed container according to the merged configuration. - * - * @param array $mergedConfig - * @param ContainerBuilder $container */ abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container); } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php index 56cd059284afe..52cc3a4a8383f 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php @@ -17,7 +17,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\EventListener\ServiceResetListener; /** * @author Alexander M. Turek @@ -26,9 +25,6 @@ class ResettableServicePass implements CompilerPassInterface { private $tagName; - /** - * @param string $tagName - */ public function __construct($tagName = 'kernel.reset') { $this->tagName = $tagName; @@ -39,7 +35,7 @@ public function __construct($tagName = 'kernel.reset') */ public function process(ContainerBuilder $container) { - if (!$container->has(ServiceResetListener::class)) { + if (!$container->has('services_resetter')) { return; } @@ -57,13 +53,13 @@ public function process(ContainerBuilder $container) } if (empty($services)) { - $container->removeDefinition(ServiceResetListener::class); + $container->removeDefinition('services_resetter'); return; } - $container->findDefinition(ServiceResetListener::class) - ->replaceArgument(0, new IteratorArgument($services)) - ->replaceArgument(1, $methods); + $container->findDefinition('services_resetter') + ->setArgument(0, new IteratorArgument($services)) + ->setArgument(1, $methods); } } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php b/src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php new file mode 100644 index 0000000000000..b82d2fef3c056 --- /dev/null +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\DependencyInjection; + +/** + * Resets provided services. + * + * @author Alexander M. Turek + * @author Nicolas Grekas + * + * @internal + */ +class ServicesResetter +{ + private $resettableServices; + private $resetMethods; + + public function __construct(\Traversable $resettableServices, array $resetMethods) + { + $this->resettableServices = $resettableServices; + $this->resetMethods = $resetMethods; + } + + public function reset() + { + foreach ($this->resettableServices as $id => $service) { + $service->{$this->resetMethods[$id]}(); + } + } +} diff --git a/src/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php b/src/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php index ed816a9d32cf9..53a7efce76cae 100644 --- a/src/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php @@ -26,11 +26,6 @@ */ class FilterResponseEvent extends KernelEvent { - /** - * The current response object. - * - * @var Response - */ private $response; public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, Response $response) @@ -52,8 +47,6 @@ public function getResponse() /** * Sets a new response object. - * - * @param Response $response */ public function setResponse(Response $response) { diff --git a/src/Symfony/Component/HttpKernel/Event/GetResponseEvent.php b/src/Symfony/Component/HttpKernel/Event/GetResponseEvent.php index 4c96a4b7d907a..f7745ea3dc160 100644 --- a/src/Symfony/Component/HttpKernel/Event/GetResponseEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/GetResponseEvent.php @@ -24,11 +24,6 @@ */ class GetResponseEvent extends KernelEvent { - /** - * The response object. - * - * @var Response - */ private $response; /** @@ -43,8 +38,6 @@ public function getResponse() /** * Sets a response and stops event propagation. - * - * @param Response $response */ public function setResponse(Response $response) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php index 280844c18313e..ecf6f59190498 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php @@ -22,14 +22,8 @@ */ class AddRequestFormatsListener implements EventSubscriberInterface { - /** - * @var array - */ protected $formats; - /** - * @param array $formats - */ public function __construct(array $formats) { $this->formats = $formats; @@ -37,8 +31,6 @@ public function __construct(array $formats) /** * Adds request formats. - * - * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 29e1725adc672..ea17cf9d9110c 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -60,8 +60,6 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $ /** * Configures the error handler. - * - * @param Event|null $event The triggering event */ public function configure(Event $event = null) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php b/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php index 88acef318722e..de19e13113e59 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php @@ -27,10 +27,6 @@ class DumpListener implements EventSubscriberInterface private $cloner; private $dumper; - /** - * @param ClonerInterface $cloner Cloner service - * @param DataDumperInterface $dumper Dumper service - */ public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper) { $this->cloner = $cloner; diff --git a/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php b/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php index 4e814525acf4a..da518fcc8e374 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php @@ -47,8 +47,6 @@ public function __construct(UriSigner $signer, $fragmentPath = '/_fragment') /** * Fixes request attributes when the path is '/_fragment'. * - * @param GetResponseEvent $event A GetResponseEvent instance - * * @throws AccessDeniedHttpException if the request does not come from a trusted IP */ public function onKernelRequest(GetResponseEvent $event) diff --git a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index 8886da01d4fd0..d2d7c422662d1 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -56,8 +56,6 @@ public function __construct(Profiler $profiler, RequestStack $requestStack, Requ /** * Handles the onKernelException event. - * - * @param GetResponseForExceptionEvent $event A GetResponseForExceptionEvent instance */ public function onKernelException(GetResponseForExceptionEvent $event) { @@ -70,8 +68,6 @@ public function onKernelException(GetResponseForExceptionEvent $event) /** * Handles the onKernelResponse event. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php index eeb2b0fcb2355..6d56197a737e7 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php @@ -31,8 +31,6 @@ public function __construct($charset) /** * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/ServiceResetListener.php b/src/Symfony/Component/HttpKernel/EventListener/ServiceResetListener.php deleted file mode 100644 index cf6d15930315f..0000000000000 --- a/src/Symfony/Component/HttpKernel/EventListener/ServiceResetListener.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Clean up services between requests. - * - * @author Alexander M. Turek - */ -class ServiceResetListener implements EventSubscriberInterface -{ - private $services; - private $resetMethods; - - public function __construct(\Traversable $services, array $resetMethods) - { - $this->services = $services; - $this->resetMethods = $resetMethods; - } - - public function onKernelTerminate() - { - foreach ($this->services as $id => $service) { - $method = $this->resetMethods[$id]; - $service->$method(); - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array( - KernelEvents::TERMINATE => array('onKernelTerminate', -2048), - ); - } -} diff --git a/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php index 571cd74e343d0..671db5d827099 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php @@ -26,8 +26,6 @@ class StreamedResponseListener implements EventSubscriberInterface { /** * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php b/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php index 358fc9776154f..37d1b9d04eaad 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php @@ -26,9 +26,6 @@ class SurrogateListener implements EventSubscriberInterface { private $surrogate; - /** - * @param SurrogateInterface $surrogate An SurrogateInterface instance - */ public function __construct(SurrogateInterface $surrogate = null) { $this->surrogate = $surrogate; @@ -36,8 +33,6 @@ public function __construct(SurrogateInterface $surrogate = null) /** * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php b/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php index b96c7814ee433..a33853f727bad 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php @@ -24,8 +24,6 @@ class ValidateRequestListener implements EventSubscriberInterface { /** * Performs the validation. - * - * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { diff --git a/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php b/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php index 3ea27e6126364..c9d952ffbe044 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php +++ b/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php @@ -48,8 +48,6 @@ public function __construct(RequestStack $requestStack, array $renderers = array /** * Adds a renderer. - * - * @param FragmentRendererInterface $renderer A FragmentRendererInterface instance */ public function addRenderer(FragmentRendererInterface $renderer) { @@ -95,8 +93,6 @@ public function render($uri, $renderer = 'inline', array $options = array()) * When the Response is a StreamedResponse, the content is streamed immediately * instead of being returned. * - * @param Response $response A Response instance - * * @return string|null The Response content or null when the Response is streamed * * @throws \RuntimeException when the Response is not successful diff --git a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php index 5cc2ac6f74dd6..5fa5b0ca8d340 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php @@ -29,10 +29,6 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer private $kernel; private $dispatcher; - /** - * @param HttpKernelInterface $kernel A HttpKernelInterface instance - * @param EventDispatcherInterface $dispatcher A EventDispatcherInterface instance - */ public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null) { $this->kernel = $kernel; diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index 41f95a47d9818..91fda4f36399d 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -503,9 +503,6 @@ protected function forward(Request $request, $catch = false, Response $entry = n /** * Checks whether the cache entry is "fresh enough" to satisfy the Request. * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * * @return bool true if the cache entry if fresh enough, false otherwise */ protected function isFreshEnough(Request $request, Response $entry) @@ -524,9 +521,6 @@ protected function isFreshEnough(Request $request, Response $entry) /** * Locks a Request during the call to the backend. * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * * @return bool true if the cache entry can be returned even if it is staled, false otherwise */ protected function lock(Request $request, Response $entry) @@ -572,9 +566,6 @@ protected function lock(Request $request, Response $entry) /** * Writes the Response to the cache. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @throws \Exception */ protected function store(Request $request, Response $response) @@ -599,9 +590,6 @@ protected function store(Request $request, Response $response) /** * Restores the Response body. - * - * @param Request $request A Request instance - * @param Response $response A Response instance */ private function restoreResponseBody(Request $request, Response $response) { @@ -643,8 +631,6 @@ protected function processResponseBody(Request $request, Response $response) * Checks if the Request includes authorization or other sensitive information * that should cause the Response to be considered private by default. * - * @param Request $request A Request instance - * * @return bool true if the Request is private, false otherwise */ private function isPrivateRequest(Request $request) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategyInterface.php b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategyInterface.php index d70c2e06ec8b0..e282299aee8a3 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategyInterface.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategyInterface.php @@ -27,15 +27,11 @@ interface ResponseCacheStrategyInterface { /** * Adds a Response. - * - * @param Response $response */ public function add(Response $response); /** * Updates the Response HTTP headers based on the embedded Responses. - * - * @param Response $response */ public function update(Response $response); } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 83c3a9ae139d9..8eeb93192cc8f 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -60,8 +60,6 @@ public function cleanup() /** * Tries to lock the cache for a given Request, without blocking. * - * @param Request $request A Request instance - * * @return bool|string true if the lock is acquired, the path to the current lock otherwise */ public function lock(Request $request) @@ -89,8 +87,6 @@ public function lock(Request $request) /** * Releases the lock for the given Request. * - * @param Request $request A Request instance - * * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise */ public function unlock(Request $request) @@ -131,8 +127,6 @@ public function isLocked(Request $request) /** * Locates a cached Response for the Request provided. * - * @param Request $request A Request instance - * * @return Response|null A Response instance, or null if no cache entry was found */ public function lookup(Request $request) @@ -173,9 +167,6 @@ public function lookup(Request $request) * Existing entries are read and any that match the response are removed. This * method calls write with the new list of cache entries. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return string The key under which the response is stored * * @throws \RuntimeException @@ -228,8 +219,6 @@ public function write(Request $request, Response $response) /** * Returns content digest for $response. * - * @param Response $response - * * @return string */ protected function generateContentDigest(Response $response) @@ -240,8 +229,6 @@ protected function generateContentDigest(Response $response) /** * Invalidates all cache entries that match the request. * - * @param Request $request A Request instance - * * @throws \RuntimeException */ public function invalidate(Request $request) @@ -432,8 +419,6 @@ public function getPath($key) * headers, use a Vary header to indicate them, and each representation will * be stored independently under the same cache key. * - * @param Request $request A Request instance - * * @return string A key for the given Request */ protected function generateCacheKey(Request $request) @@ -444,8 +429,6 @@ protected function generateCacheKey(Request $request) /** * Returns a cache key for the given Request. * - * @param Request $request A Request instance - * * @return string A key for the given Request */ private function getCacheKey(Request $request) @@ -460,8 +443,6 @@ private function getCacheKey(Request $request) /** * Persists the Request HTTP headers. * - * @param Request $request A Request instance - * * @return array An array of HTTP headers */ private function persistRequest(Request $request) @@ -472,8 +453,6 @@ private function persistRequest(Request $request) /** * Persists the Response HTTP headers. * - * @param Response $response A Response instance - * * @return array An array of HTTP headers */ private function persistResponse(Response $response) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php b/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php index ddc0c04ee3960..8f1cf4409eee8 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php @@ -27,8 +27,6 @@ interface StoreInterface /** * Locates a cached Response for the Request provided. * - * @param Request $request A Request instance - * * @return Response|null A Response instance, or null if no cache entry was found */ public function lookup(Request $request); @@ -39,25 +37,18 @@ public function lookup(Request $request); * Existing entries are read and any that match the response are removed. This * method calls write with the new list of cache entries. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return string The key under which the response is stored */ public function write(Request $request, Response $response); /** * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance */ public function invalidate(Request $request); /** * Locks the cache for a given Request. * - * @param Request $request A Request instance - * * @return bool|string true if the lock is acquired, the path to the current lock otherwise */ public function lock(Request $request); @@ -65,8 +56,6 @@ public function lock(Request $request); /** * Releases the lock for the given Request. * - * @param Request $request A Request instance - * * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise */ public function unlock(Request $request); @@ -74,8 +63,6 @@ public function unlock(Request $request); /** * Returns whether or not a lock exists. * - * @param Request $request A Request instance - * * @return bool true if lock exists, false otherwise */ public function isLocked(Request $request); diff --git a/src/Symfony/Component/HttpKernel/HttpCache/SurrogateInterface.php b/src/Symfony/Component/HttpKernel/HttpCache/SurrogateInterface.php index 5d65fd65a4436..85391f8f36b17 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/SurrogateInterface.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/SurrogateInterface.php @@ -33,16 +33,12 @@ public function createCacheStrategy(); /** * Checks that at least one surrogate has Surrogate capability. * - * @param Request $request A Request instance - * * @return bool true if one surrogate has Surrogate capability, false otherwise */ public function hasSurrogateCapability(Request $request); /** * Adds Surrogate-capability to the given Request. - * - * @param Request $request A Request instance */ public function addSurrogateCapability(Request $request); @@ -50,16 +46,12 @@ public function addSurrogateCapability(Request $request); * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate. * * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags. - * - * @param Response $response A Response instance */ public function addSurrogateControl(Response $response); /** * Checks that the Response needs to be parsed for Surrogate tags. * - * @param Response $response A Response instance - * * @return bool true if the Response needs to be parsed, false otherwise */ public function needsParsing(Response $response); @@ -79,9 +71,6 @@ public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comme /** * Replaces a Response Surrogate tags with the included resource content. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return Response */ public function process(Request $request, Response $response); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 26facc144de1c..ff0964009ddab 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -60,13 +60,15 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $projectDir; private $warmupDir; + private $requestStackSize = 0; + private $resetServices = false; - const VERSION = '4.0.0-BETA1'; + const VERSION = '4.0.0-BETA2'; const VERSION_ID = 40000; const MAJOR_VERSION = 4; const MINOR_VERSION = 0; const RELEASE_VERSION = 0; - const EXTRA_VERSION = 'BETA1'; + const EXTRA_VERSION = 'BETA2'; const END_OF_MAINTENANCE = '07/2018'; const END_OF_LIFE = '01/2019'; @@ -95,6 +97,8 @@ public function __clone() $this->booted = false; $this->container = null; + $this->requestStackSize = 0; + $this->resetServices = false; } /** @@ -103,8 +107,20 @@ public function __clone() public function boot() { if (true === $this->booted) { + if (!$this->requestStackSize && $this->resetServices) { + if ($this->container->has('services_resetter')) { + $this->container->get('services_resetter')->reset(); + } + $this->resetServices = false; + } + return; } + if ($this->debug && !isset($_SERVER['SHELL_VERBOSITY'])) { + putenv('SHELL_VERBOSITY=3'); + $_ENV['SHELL_VERBOSITY'] = 3; + $_SERVER['SHELL_VERBOSITY'] = 3; + } // init bundles $this->initializeBundles(); @@ -161,6 +177,8 @@ public function shutdown() } $this->container = null; + $this->requestStackSize = 0; + $this->resetServices = false; } /** @@ -168,17 +186,15 @@ public function shutdown() */ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { - if (false === $this->booted) { - if ($this->debug && !isset($_SERVER['SHELL_VERBOSITY'])) { - putenv('SHELL_VERBOSITY=3'); - $_ENV['SHELL_VERBOSITY'] = 3; - $_SERVER['SHELL_VERBOSITY'] = 3; - } + $this->boot(); + ++$this->requestStackSize; + $this->resetServices = true; - $this->boot(); + try { + return $this->getHttpKernel()->handle($request, $type, $catch); + } finally { + --$this->requestStackSize; } - - return $this->getHttpKernel()->handle($request, $type, $catch); } /** @@ -579,8 +595,6 @@ protected function buildContainer() /** * Prepares the ContainerBuilder before it is compiled. - * - * @param ContainerBuilder $container A ContainerBuilder instance */ protected function prepareContainer(ContainerBuilder $container) { @@ -666,8 +680,6 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container /** * Returns a loader for the container. * - * @param ContainerInterface $container The service container - * * @return DelegatingLoader The loader */ protected function getContainerLoader(ContainerInterface $container) diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index 65c1a17fba779..e58fbd2ed5b64 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -33,8 +33,6 @@ public function registerBundles(); /** * Loads the container configuration. - * - * @param LoaderInterface $loader A LoaderInterface instance */ public function registerContainerConfiguration(LoaderInterface $loader); diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profile.php b/src/Symfony/Component/HttpKernel/Profiler/Profile.php index fba74ed846443..483baa290a4ae 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profile.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profile.php @@ -73,8 +73,6 @@ public function getToken() /** * Sets the parent token. - * - * @param Profile $parent */ public function setParent(Profile $parent) { @@ -214,8 +212,6 @@ public function setChildren(array $children) /** * Adds the child token. - * - * @param Profile $child */ public function addChild(Profile $child) { @@ -266,8 +262,6 @@ public function setCollectors(array $collectors) /** * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance */ public function addCollector(DataCollectorInterface $collector) { diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php index c99e7113fc88f..a25321897d46f 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php @@ -25,9 +25,6 @@ */ class Profiler { - /** - * @var ProfilerStorageInterface - */ private $storage; /** @@ -35,25 +32,12 @@ class Profiler */ private $collectors = array(); - /** - * @var LoggerInterface - */ private $logger; - - /** - * @var bool - */ private $initiallyEnabled = true; - - /** - * @var bool - */ private $enabled = true; /** - * @param ProfilerStorageInterface $storage A ProfilerStorageInterface instance - * @param LoggerInterface $logger A LoggerInterface instance - * @param bool $enable The initial enabled state + * @param bool $enable The initial enabled state */ public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, $enable = true) { @@ -81,8 +65,6 @@ public function enable() /** * Loads the Profile for the given Response. * - * @param Response $response A Response instance - * * @return Profile|false A Profile instance */ public function loadProfileFromResponse(Response $response) @@ -109,8 +91,6 @@ public function loadProfile($token) /** * Saves a Profile. * - * @param Profile $profile A Profile instance - * * @return bool */ public function saveProfile(Profile $profile) @@ -160,10 +140,6 @@ public function find($ip, $url, $limit, $method, $start, $end, $statusCode = nul /** * Collects data for the given Response. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An exception instance if the request threw one - * * @return Profile|null A Profile instance or null if the profiler is disabled */ public function collect(Request $request, Response $response, \Exception $exception = null) @@ -228,8 +204,6 @@ public function set(array $collectors = array()) /** * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance */ public function add(DataCollectorInterface $collector) { diff --git a/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php index ea72af2314f6f..544fb1fef6ec6 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php +++ b/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php @@ -46,8 +46,6 @@ public function read($token); /** * Saves a Profile. * - * @param Profile $profile A Profile instance - * * @return bool Write operation successful */ public function write(Profile $profile); diff --git a/src/Symfony/Component/HttpKernel/TerminableInterface.php b/src/Symfony/Component/HttpKernel/TerminableInterface.php index d55a15b87ef2e..8aa331979340c 100644 --- a/src/Symfony/Component/HttpKernel/TerminableInterface.php +++ b/src/Symfony/Component/HttpKernel/TerminableInterface.php @@ -27,9 +27,6 @@ interface TerminableInterface * Terminates a request/response cycle. * * Should be called after sending the response and before shutting down the kernel. - * - * @param Request $request A Request instance - * @param Response $response A Response instance */ public function terminate(Request $request, Response $response); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php index c998ef2eaf086..f7ea16dbfb036 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; -use Symfony\Component\HttpKernel\EventListener\ServiceResetListener; +use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService; use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; @@ -24,14 +24,14 @@ public function testCompilerPass() ->setPublic(true) ->addTag('kernel.reset', array('method' => 'clear')); - $container->register(ServiceResetListener::class) + $container->register('services_resetter', ServicesResetter::class) ->setPublic(true) ->setArguments(array(null, array())); - $container->addCompilerPass(new ResettableServicePass('kernel.reset')); + $container->addCompilerPass(new ResettableServicePass()); $container->compile(); - $definition = $container->getDefinition(ServiceResetListener::class); + $definition = $container->getDefinition('services_resetter'); $this->assertEquals( array( @@ -57,9 +57,9 @@ public function testMissingMethod() $container = new ContainerBuilder(); $container->register(ResettableService::class) ->addTag('kernel.reset'); - $container->register(ServiceResetListener::class) + $container->register('services_resetter', ServicesResetter::class) ->setArguments(array(null, array())); - $container->addCompilerPass(new ResettableServicePass('kernel.reset')); + $container->addCompilerPass(new ResettableServicePass()); $container->compile(); } @@ -67,22 +67,12 @@ public function testMissingMethod() public function testCompilerPassWithoutResetters() { $container = new ContainerBuilder(); - $container->register(ServiceResetListener::class) + $container->register('services_resetter', ServicesResetter::class) ->setArguments(array(null, array())); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); - $this->assertFalse($container->has(ServiceResetListener::class)); - } - - public function testCompilerPassWithoutListener() - { - $container = new ContainerBuilder(); - $container->addCompilerPass(new ResettableServicePass()); - - $container->compile(); - - $this->assertFalse($container->has(ServiceResetListener::class)); + $this->assertFalse($container->has('services_resetter')); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php new file mode 100644 index 0000000000000..47c62abd0d998 --- /dev/null +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ServicesResetterTest.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; +use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService; +use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; + +class ServicesResetterTest extends TestCase +{ + protected function setUp() + { + ResettableService::$counter = 0; + ClearableService::$counter = 0; + } + + public function testResetServices() + { + $resetter = new ServicesResetter(new \ArrayIterator(array( + 'id1' => new ResettableService(), + 'id2' => new ClearableService(), + )), array( + 'id1' => 'reset', + 'id2' => 'clear', + )); + + $resetter->reset(); + + $this->assertEquals(1, ResettableService::$counter); + $this->assertEquals(1, ClearableService::$counter); + } +} diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ServiceResetListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ServiceResetListenerTest.php deleted file mode 100644 index 603d11b2bf412..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ServiceResetListenerTest.php +++ /dev/null @@ -1,77 +0,0 @@ -buildContainer(); - $container->get('reset_subscriber')->onKernelTerminate(); - - $this->assertEquals(0, ResettableService::$counter); - $this->assertEquals(0, ClearableService::$counter); - } - - public function testResetServicesPartially() - { - $container = $this->buildContainer(); - $container->get('one'); - $container->get('reset_subscriber')->onKernelTerminate(); - - $this->assertEquals(1, ResettableService::$counter); - $this->assertEquals(0, ClearableService::$counter); - } - - public function testResetServicesTwice() - { - $container = $this->buildContainer(); - $container->get('one'); - $container->get('reset_subscriber')->onKernelTerminate(); - $container->get('two'); - $container->get('reset_subscriber')->onKernelTerminate(); - - $this->assertEquals(2, ResettableService::$counter); - $this->assertEquals(1, ClearableService::$counter); - } - - /** - * @return ContainerBuilder - */ - private function buildContainer() - { - $container = new ContainerBuilder(); - $container->register('one', ResettableService::class)->setPublic(true); - $container->register('two', ClearableService::class)->setPublic(true); - - $container->register('reset_subscriber', ServiceResetListener::class) - ->setPublic(true) - ->addArgument(new IteratorArgument(array( - 'one' => new Reference('one', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), - 'two' => new Reference('two', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), - ))) - ->addArgument(array( - 'one' => 'reset', - 'two' => 'clear', - )); - - $container->compile(); - - return $container; - } -} diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 5b259e7ff66eb..b70a859fff2f8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -17,6 +17,8 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; +use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; @@ -24,6 +26,7 @@ use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles; +use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; class KernelTest extends TestCase { @@ -528,6 +531,38 @@ public function testKernelPass() $this->assertTrue($kernel->getContainer()->getParameter('test.processed')); } + public function testServicesResetter() + { + $httpKernelMock = $this->getMockBuilder(HttpKernelInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $httpKernelMock + ->expects($this->exactly(2)) + ->method('handle'); + + $kernel = new CustomProjectDirKernel(function ($container) { + $container->addCompilerPass(new ResettableServicePass()); + $container->register('one', ResettableService::class) + ->setPublic(true) + ->addTag('kernel.reset', array('method' => 'reset')); + $container->register('services_resetter', ServicesResetter::class)->setPublic(true); + }, $httpKernelMock, 'resetting'); + + ResettableService::$counter = 0; + + $request = new Request(); + + $kernel->handle($request); + $kernel->getContainer()->get('one'); + + $this->assertEquals(0, ResettableService::$counter); + $this->assertFalse($kernel->getContainer()->initialized('services_resetter')); + + $kernel->handle($request); + + $this->assertEquals(1, ResettableService::$counter); + } + /** * Returns a mock for the BundleInterface. * @@ -629,13 +664,15 @@ class CustomProjectDirKernel extends Kernel { private $baseDir; private $buildContainer; + private $httpKernel; - public function __construct(\Closure $buildContainer = null) + public function __construct(\Closure $buildContainer = null, HttpKernelInterface $httpKernel = null, $name = 'custom') { - parent::__construct('custom', true); + parent::__construct($name, true); $this->baseDir = 'foo'; $this->buildContainer = $buildContainer; + $this->httpKernel = $httpKernel; } public function registerBundles() @@ -663,6 +700,11 @@ protected function build(ContainerBuilder $container) $build($container); } } + + protected function getHttpKernel() + { + return $this->httpKernel; + } } class PassKernel extends CustomProjectDirKernel implements CompilerPassInterface diff --git a/src/Symfony/Component/HttpKernel/UriSigner.php b/src/Symfony/Component/HttpKernel/UriSigner.php index c3df23197cc62..28459b4ecd394 100644 --- a/src/Symfony/Component/HttpKernel/UriSigner.php +++ b/src/Symfony/Component/HttpKernel/UriSigner.php @@ -58,10 +58,6 @@ public function sign($uri) /** * Checks that a URI contains the correct hash. * - * The query string parameter must be the last one - * (as it is generated that way by the sign() method, it should - * never be a problem). - * * @param string $uri A signed URI * * @return bool True if the URI is signed correctly, false otherwise diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 79b6848a47517..9630dbdd42c93 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -24,7 +24,6 @@ }, "require-dev": { "symfony/browser-kit": "~3.4|~4.0", - "symfony/class-loader": "~3.4|~4.0", "symfony/config": "~3.4|~4.0", "symfony/console": "~3.4|~4.0", "symfony/css-selector": "~3.4|~4.0", diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php index 3cf969bab8134..aedcac918515b 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php @@ -28,22 +28,15 @@ */ class BundleEntryReader implements BundleEntryReaderInterface { - /** - * @var BundleReaderInterface - */ private $reader; /** * A mapping of locale aliases to locales. - * - * @var array */ private $localeAliases = array(); /** * Creates an entry reader based on the given resource bundle reader. - * - * @param BundleReaderInterface $reader A resource bundle reader to use */ public function __construct(BundleReaderInterface $reader) { diff --git a/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php index 19cf6eab00a70..cd9da7c13cb3f 100644 --- a/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php @@ -53,8 +53,6 @@ class CurrencyDataGenerator extends AbstractDataGenerator /** * Monetary units excluded from generation. - * - * @var array */ private static $blacklist = array( self::UNKNOWN_CURRENCY_ID => true, @@ -162,8 +160,6 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir) } /** - * @param ArrayAccessibleResourceBundle $rootBundle - * * @return array */ private function generateSymbolNamePairs(ArrayAccessibleResourceBundle $rootBundle) diff --git a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php index 59987594235f0..77bcb00c85f4f 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php @@ -28,8 +28,6 @@ class LanguageDataGenerator extends AbstractDataGenerator { /** * Source: http://www-01.sil.org/iso639-3/codes.asp. - * - * @var array */ private static $preferredAlpha2ToAlpha3Mapping = array( 'ak' => 'aka', diff --git a/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php index 28c90a5ed98b8..9c9006d7bac28 100644 --- a/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php @@ -43,8 +43,6 @@ class RegionDataGenerator extends AbstractDataGenerator /** * Regions excluded from generation. - * - * @var array */ private static $blacklist = array( self::UNKNOWN_REGION_ID => true, @@ -135,8 +133,6 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir) } /** - * @param ArrayAccessibleResourceBundle $localeBundle - * * @return array */ protected function generateRegionNames(ArrayAccessibleResourceBundle $localeBundle) diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php index dede7b36fe8d1..fa312d7f11d98 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php @@ -251,8 +251,6 @@ protected function buildCharsMatch($specialChars) * Normalize a preg_replace match array, removing the numeric keys and returning an associative array * with the value and pattern values for the matched Transformer. * - * @param array $data - * * @return array */ protected function normalizeArray(array $data) @@ -330,8 +328,6 @@ protected function calculateUnixTimestamp(\DateTime $dateTime, array $options) * Add sensible default values for missing items in the extracted date/time options array. The values * are base in the beginning of the Unix era. * - * @param array $options - * * @return array */ private function getDefaultValueForOptions(array $options) diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php index a5cb421aad358..ed669398f0ca2 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php @@ -20,9 +20,6 @@ */ class MonthTransformer extends Transformer { - /** - * @var array - */ protected static $months = array( 'January', 'February', @@ -40,22 +37,16 @@ class MonthTransformer extends Transformer /** * Short months names (first 3 letters). - * - * @var array */ protected static $shortMonths = array(); /** * Flipped $months array, $name => $index. - * - * @var array */ protected static $flippedMonths = array(); /** * Flipped $shortMonths array, $name => $index. - * - * @var array */ protected static $flippedShortMonths = array(); diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php index b1b121ff23a7c..809707593f013 100644 --- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php +++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php @@ -75,8 +75,6 @@ class IntlDateFormatter /** * Patterns used to format the date when no pattern is provided. - * - * @var array */ private $defaultDateFormats = array( self::NONE => '', @@ -88,8 +86,6 @@ class IntlDateFormatter /** * Patterns used to format the time when no pattern is provided. - * - * @var array */ private $defaultTimeFormats = array( self::FULL => 'h:mm:ss a zzzz', diff --git a/src/Symfony/Component/Intl/Locale.php b/src/Symfony/Component/Intl/Locale.php index 236e58e3f676f..9b74fa4da3fa4 100644 --- a/src/Symfony/Component/Intl/Locale.php +++ b/src/Symfony/Component/Intl/Locale.php @@ -21,7 +21,7 @@ final class Locale extends \Locale { /** - * @var string + * @var string|null */ private static $defaultFallback = 'en'; @@ -31,11 +31,11 @@ final class Locale extends \Locale * The default fallback locale is used as fallback for locales that have no * fallback otherwise. * - * @param string $locale The default fallback locale + * @param string|null $locale The default fallback locale * * @see getFallback() */ - public static function setDefaultFallback(string $locale) + public static function setDefaultFallback(?string $locale) { self::$defaultFallback = $locale; } @@ -43,12 +43,12 @@ public static function setDefaultFallback(string $locale) /** * Returns the default fallback locale. * - * @return string The default fallback locale + * @return string|null The default fallback locale * * @see setDefaultFallback() * @see getFallback() */ - public static function getDefaultFallback(): string + public static function getDefaultFallback(): ?string { return self::$defaultFallback; } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php index 1a2c35ffb7513..88af2e775b94f 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php @@ -215,8 +215,6 @@ protected function isIntlFailure($errorCode) * + 10 seconds) are added, then we have 86,400 seconds (24h * 60min * 60s) * + 10 seconds * - * @param array $dataSets - * * @return array */ private function notImplemented(array $dataSets) diff --git a/src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php b/src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php index 60317243e9c4f..4d9699df4c9c5 100644 --- a/src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php +++ b/src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php @@ -41,61 +41,49 @@ public function __construct(OptionsResolver $optionsResolver) } /** - * @param string $option - * * @return mixed * * @throws NoConfigurationException on no configured value */ - public function getDefault($option) + public function getDefault(string $option) { return call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option)); } /** - * @param string $option - * * @return \Closure[] * * @throws NoConfigurationException on no configured closures */ - public function getLazyClosures($option) + public function getLazyClosures(string $option): array { return call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option)); } /** - * @param string $option - * * @return string[] * * @throws NoConfigurationException on no configured types */ - public function getAllowedTypes($option) + public function getAllowedTypes(string $option): array { return call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option)); } /** - * @param string $option - * * @return mixed[] * * @throws NoConfigurationException on no configured values */ - public function getAllowedValues($option) + public function getAllowedValues(string $option): array { return call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option)); } /** - * @param string $option - * - * @return \Closure - * * @throws NoConfigurationException on no configured normalizer */ - public function getNormalizer($option) + public function getNormalizer(string $option): \Closure { return call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option)); } diff --git a/src/Symfony/Component/Process/ExecutableFinder.php b/src/Symfony/Component/Process/ExecutableFinder.php index d8e689622a537..d042a5b13a211 100644 --- a/src/Symfony/Component/Process/ExecutableFinder.php +++ b/src/Symfony/Component/Process/ExecutableFinder.php @@ -23,8 +23,6 @@ class ExecutableFinder /** * Replaces default suffixes of executable. - * - * @param array $suffixes */ public function setSuffixes(array $suffixes) { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 7c5e4a5a338aa..fd9803c5592d9 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -83,8 +83,6 @@ class Process implements \IteratorAggregate * Exit codes translation table. * * User-defined errors must use exit codes in the 64-113 range. - * - * @var array */ public static $exitCodes = array( 0 => 'OK', @@ -196,7 +194,7 @@ public function __clone() * * @final since version 3.3 */ - public function run($callback = null, array $env = array()) + public function run(callable $callback = null, array $env = array()) { $this->start($callback, $env); diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php index 5f739158c9b14..25712af7ded1a 100644 --- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php @@ -29,10 +29,12 @@ public function testProcessFailedExceptionThrowsException() ->method('isSuccessful') ->will($this->returnValue(true)); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}( - '\InvalidArgumentException', - 'Expected a failed process, but the given process was successful.' - ); + if (method_exists($this, 'expectException')) { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Expected a failed process, but the given process was successful.'); + } else { + $this->setExpectedException(\InvalidArgumentException::class, 'Expected a failed process, but the given process was successful.'); + } new ProcessFailedException($process); } diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 3d64615d1da97..d07d07fd835d8 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -20,8 +20,8 @@ use Symfony\Component\Inflector\Inflector; use Symfony\Component\PropertyAccess\Exception\AccessException; use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; -use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException; +use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException; /** @@ -55,10 +55,6 @@ class PropertyAccessor implements PropertyAccessorInterface * @var bool */ private $magicCall; - - /** - * @var bool - */ private $ignoreInvalidIndices; /** @@ -66,22 +62,10 @@ class PropertyAccessor implements PropertyAccessorInterface */ private $cacheItemPool; - /** - * @var array - */ private $readPropertyCache = array(); - - /** - * @var array - */ private $writePropertyCache = array(); private static $resultProto = array(self::VALUE => null); - /** - * @var array - */ - private $propertyPathCache = array(); - /** * Should not be used by application code. Use * {@link PropertyAccess::createPropertyAccessor()} instead. @@ -386,7 +370,7 @@ private function readIndex($zval, $index) private function readProperty($zval, $property) { if (!is_object($zval[self::VALUE])) { - throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%s]" instead.', $property, $property)); + throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property)); } $result = self::$resultProto; @@ -537,7 +521,7 @@ private function writeIndex($zval, $index, $value) private function writeProperty($zval, $property, $value) { if (!is_object($zval[self::VALUE])) { - throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%s]" instead?', $property, $property)); + throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property)); } $object = $zval[self::VALUE]; diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php index 9d1e0870715a5..de80751ce28ca 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php @@ -18,14 +18,7 @@ */ class PropertyPathBuilder { - /** - * @var array - */ private $elements = array(); - - /** - * @var array - */ private $isIndex = array(); /** diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php b/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php index 7ea0fa2455488..02fa26e1fc5bc 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php @@ -19,11 +19,6 @@ */ class PropertyPathIterator extends \ArrayIterator implements PropertyPathIteratorInterface { - /** - * The traversed property path. - * - * @var PropertyPathInterface - */ protected $path; /** diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index a84b947b890a2..5ae275336c8c8 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -168,15 +168,7 @@ public function getTypes($class, $property, array $context = array()) return array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $types[0])); } - /** - * Gets the DocBlock for this property. - * - * @param string $class - * @param string $property - * - * @return array - */ - private function getDocBlock($class, $property) + private function getDocBlock(string $class, string $property): array { $propertyHash = sprintf('%s::%s', $class, $property); @@ -210,36 +202,19 @@ private function getDocBlock($class, $property) return $this->docBlocks[$propertyHash] = $data; } - /** - * Gets the DocBlock from a property. - * - * @param string $class - * @param string $property - * - * @return DocBlock|null - */ - private function getDocBlockFromProperty($class, $property) + private function getDocBlockFromProperty(string $class, string $property): ?DocBlock { // Use a ReflectionProperty instead of $class to get the parent class if applicable try { $reflectionProperty = new \ReflectionProperty($class, $property); } catch (\ReflectionException $e) { - return; + return null; } return $this->docBlockFactory->create($reflectionProperty, $this->contextFactory->createFromReflector($reflectionProperty)); } - /** - * Gets DocBlock from accessor or mutator method. - * - * @param string $class - * @param string $ucFirstProperty - * @param int $type - * - * @return array|null - */ - private function getDocBlockFromMethod($class, $ucFirstProperty, $type) + private function getDocBlockFromMethod(string $class, string $ucFirstProperty, int $type): ?array { $prefixes = self::ACCESSOR === $type ? $this->accessorPrefixes : $this->mutatorPrefixes; $prefix = null; @@ -265,7 +240,7 @@ private function getDocBlockFromMethod($class, $ucFirstProperty, $type) } if (!isset($reflectionMethod)) { - return; + return null; } return array($this->docBlockFactory->create($reflectionMethod, $this->contextFactory->createFromReflector($reflectionMethod)), $prefix); diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 68506c4eb4da5..b62b54691cd77 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -47,19 +47,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp */ public static $defaultArrayMutatorPrefixes = array('add', 'remove'); - /** - * @var string[] - */ private $mutatorPrefixes; - - /** - * @var string[] - */ private $accessorPrefixes; - - /** - * @var string[] - */ private $arrayMutatorPrefixes; /** @@ -155,11 +144,6 @@ public function isWritable($class, $property, array $context = array()) } /** - * Tries to extract type information from mutators. - * - * @param string $class - * @param string $property - * * @return Type[]|null */ private function extractFromMutator(string $class, string $property): ?array @@ -187,9 +171,6 @@ private function extractFromMutator(string $class, string $property): ?array /** * Tries to extract type information from accessors. * - * @param string $class - * @param string $property - * * @return Type[]|null */ private function extractFromAccessor(string $class, string $property): ?array @@ -210,13 +191,6 @@ private function extractFromAccessor(string $class, string $property): ?array return null; } - /** - * Extracts data from the PHP 7 reflection type. - * - * @param \ReflectionType $reflectionType - * - * @return Type - */ private function extractFromReflectionType(\ReflectionType $reflectionType): Type { $phpTypeOrClass = $reflectionType->getName(); @@ -235,14 +209,6 @@ private function extractFromReflectionType(\ReflectionType $reflectionType): Typ return $type; } - /** - * Does the class have the given public property? - * - * @param string $class - * @param string $property - * - * @return bool - */ private function isPublicProperty(string $class, string $property): bool { try { @@ -261,11 +227,6 @@ private function isPublicProperty(string $class, string $property): bool * * Returns an array with a the instance of \ReflectionMethod as first key * and the prefix of the method as second or null if not found. - * - * @param string $class - * @param string $property - * - * @return array|null */ private function getAccessorMethod(string $class, string $property): ?array { @@ -290,17 +251,10 @@ private function getAccessorMethod(string $class, string $property): ?array } /** - * Gets the mutator method. - * * Returns an array with a the instance of \ReflectionMethod as first key * and the prefix of the method as second or null if not found. - * - * @param string $class - * @param string $property - * - * @return array */ - private function getMutatorMethod(string $class, string $property) + private function getMutatorMethod(string $class, string $property): ?array { $ucProperty = ucfirst($property); $ucSingulars = (array) Inflector::singularize($ucProperty); @@ -327,17 +281,11 @@ private function getMutatorMethod(string $class, string $property) } } } + + return null; } - /** - * Extracts a property name from a method name. - * - * @param string $methodName - * @param \ReflectionProperty[] $reflectionProperties - * - * @return string - */ - private function getPropertyName(string $methodName, array $reflectionProperties) + private function getPropertyName(string $methodName, array $reflectionProperties): ?string { $pattern = implode('|', array_merge($this->accessorPrefixes, $this->mutatorPrefixes)); @@ -356,5 +304,7 @@ private function getPropertyName(string $methodName, array $reflectionProperties return $matches[2]; } + + return null; } } diff --git a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php index 22e409c1011eb..f2d3a82964dc0 100644 --- a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php +++ b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php @@ -31,7 +31,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface * @param iterable|PropertyDescriptionExtractorInterface[] $descriptionExtractors * @param iterable|PropertyAccessExtractorInterface[] $accessExtractors */ - public function __construct($listExtractors = array(), $typeExtractors = array(), $descriptionExtractors = array(), $accessExtractors = array()) + public function __construct(iterable $listExtractors = array(), iterable $typeExtractors = array(), iterable $descriptionExtractors = array(), iterable $accessExtractors = array()) { $this->listExtractors = $listExtractors; $this->typeExtractors = $typeExtractors; @@ -90,13 +90,9 @@ public function isWritable($class, $property, array $context = array()) /** * Iterates over registered extractors and return the first value found. * - * @param iterable $extractors - * @param string $method - * @param array $arguments - * * @return mixed */ - private function extract($extractors, $method, array $arguments) + private function extract(iterable $extractors, string $method, array $arguments) { foreach ($extractors as $extractor) { $value = call_user_func_array(array($extractor, $method), $arguments); diff --git a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php index 9266f9808fb55..cd1cab9167371 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/TypeTest.php @@ -37,6 +37,12 @@ public function testConstruct() $this->assertEquals(Type::BUILTIN_TYPE_STRING, $collectionValueType->getBuiltinType()); } + public function testIterable() + { + $type = new Type('iterable'); + $this->assertSame('iterable', $type->getBuiltinType()); + } + /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage "foo" is not a valid PHP type. diff --git a/src/Symfony/Component/PropertyInfo/Type.php b/src/Symfony/Component/PropertyInfo/Type.php index 5d05a48f09a48..67ad7ccef1651 100644 --- a/src/Symfony/Component/PropertyInfo/Type.php +++ b/src/Symfony/Component/PropertyInfo/Type.php @@ -29,6 +29,7 @@ class Type const BUILTIN_TYPE_ARRAY = 'array'; const BUILTIN_TYPE_NULL = 'null'; const BUILTIN_TYPE_CALLABLE = 'callable'; + const BUILTIN_TYPE_ITERABLE = 'iterable'; /** * List of PHP builtin types. @@ -45,6 +46,7 @@ class Type self::BUILTIN_TYPE_ARRAY, self::BUILTIN_TYPE_CALLABLE, self::BUILTIN_TYPE_NULL, + self::BUILTIN_TYPE_ITERABLE, ); /** @@ -78,16 +80,9 @@ class Type private $collectionValueType; /** - * @param string $builtinType - * @param bool $nullable - * @param string|null $class - * @param bool $collection - * @param Type|null $collectionKeyType - * @param Type|null $collectionValueType - * * @throws \InvalidArgumentException */ - public function __construct($builtinType, $nullable = false, $class = null, $collection = false, Type $collectionKeyType = null, Type $collectionValueType = null) + public function __construct(string $builtinType, bool $nullable = false, string $class = null, bool $collection = false, Type $collectionKeyType = null, Type $collectionValueType = null) { if (!in_array($builtinType, self::$builtinTypes)) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid PHP type.', $builtinType)); @@ -104,21 +99,14 @@ public function __construct($builtinType, $nullable = false, $class = null, $col /** * Gets built-in type. * - * Can be bool, int, float, string, array, object, resource, null or callback. - * - * @return string + * Can be bool, int, float, string, array, object, resource, null, callback or iterable. */ - public function getBuiltinType() + public function getBuiltinType(): string { return $this->builtinType; } - /** - * Allows null value? - * - * @return bool - */ - public function isNullable() + public function isNullable(): bool { return $this->nullable; } @@ -127,20 +115,13 @@ public function isNullable() * Gets the class name. * * Only applicable if the built-in type is object. - * - * @return string|null */ - public function getClassName() + public function getClassName(): ?string { return $this->class; } - /** - * Is collection? - * - * @return bool - */ - public function isCollection() + public function isCollection(): bool { return $this->collection; } @@ -149,10 +130,8 @@ public function isCollection() * Gets collection key type. * * Only applicable for a collection type. - * - * @return self|null */ - public function getCollectionKeyType() + public function getCollectionKeyType(): ?self { return $this->collectionKeyType; } @@ -161,10 +140,8 @@ public function getCollectionKeyType() * Gets collection value type. * * Only applicable for a collection type. - * - * @return self|null */ - public function getCollectionValueType() + public function getCollectionValueType(): ?self { return $this->collectionValueType; } diff --git a/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php b/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php index f684c74916c15..712412fecec58 100644 --- a/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php +++ b/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php @@ -20,9 +20,6 @@ */ class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface { - /** - * @var array - */ protected $allowedMethods = array(); public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null) diff --git a/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php b/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php index 4a7051b5ae797..659c5ba1c8074 100644 --- a/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php +++ b/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php @@ -20,14 +20,8 @@ */ abstract class GeneratorDumper implements GeneratorDumperInterface { - /** - * @var RouteCollection - */ private $routes; - /** - * @param RouteCollection $routes The RouteCollection to dump - */ public function __construct(RouteCollection $routes) { $this->routes = $routes; diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index 7e4fa34736e82..4d00f3a096e3b 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -27,14 +27,7 @@ */ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface { - /** - * @var RouteCollection - */ protected $routes; - - /** - * @var RequestContext - */ protected $context; /** @@ -42,9 +35,6 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt */ protected $strictRequirements = true; - /** - * @var LoggerInterface|null - */ protected $logger; /** @@ -75,11 +65,6 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt '%7C' => '|', ); - /** - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * @param LoggerInterface|null $logger A logger instance - */ public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) { $this->routes = $routes; diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index cfca3b9caacde..2fe6fb596e42a 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -57,9 +57,6 @@ */ abstract class AnnotationClassLoader implements LoaderInterface { - /** - * @var Reader - */ protected $reader; /** @@ -72,9 +69,6 @@ abstract class AnnotationClassLoader implements LoaderInterface */ protected $defaultRouteIndex = 0; - /** - * @param Reader $reader - */ public function __construct(Reader $reader) { $this->reader = $reader; diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 18f91746c580a..48ea056e733e4 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -27,9 +27,6 @@ class AnnotationFileLoader extends FileLoader protected $loader; /** - * @param FileLocatorInterface $locator A FileLocator instance - * @param AnnotationClassLoader $loader An AnnotationClassLoader instance - * * @throws \RuntimeException */ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) diff --git a/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php index 67d5c77de5459..38d86cb895cb4 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php @@ -42,7 +42,7 @@ public function __destruct() * Adds a route. * * @param string $name - * @param string $value + * @param string $path * * @return RouteConfigurator */ diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php b/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php index b24c8512ce1c9..6916297b8c174 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php @@ -105,8 +105,6 @@ protected function getParent() /** * Sets the parent collection. - * - * @param DumperCollection $parent The parent collection */ protected function setParent(DumperCollection $parent) { diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php index 70c23f647d91d..ea51ab4063047 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php @@ -20,14 +20,8 @@ */ abstract class MatcherDumper implements MatcherDumperInterface { - /** - * @var RouteCollection - */ private $routes; - /** - * @param RouteCollection $routes The RouteCollection to dump - */ public function __construct(RouteCollection $routes) { $this->routes = $routes; diff --git a/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php b/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php index 097929555d7e5..1eef778a56bc0 100644 --- a/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php +++ b/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php @@ -29,8 +29,6 @@ interface RequestMatcherInterface * If the matcher can not find information, it must throw one of the exceptions documented * below. * - * @param Request $request The request to match - * * @return array An array of parameters * * @throws NoConfigurationException If no routing configuration could be found diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index abd04c4208edf..3cba7e66f8606 100644 --- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -32,21 +32,9 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface const REQUIREMENT_MISMATCH = 1; const ROUTE_MATCH = 2; - /** - * @var RequestContext - */ protected $context; - - /** - * @var array - */ protected $allow = array(); - - /** - * @var RouteCollection - */ protected $routes; - protected $request; protected $expressionLanguage; @@ -55,10 +43,6 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface */ protected $expressionLanguageProviders = array(); - /** - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - */ public function __construct(RouteCollection $routes, RequestContext $context) { $this->routes = $routes; diff --git a/src/Symfony/Component/Routing/RequestContext.php b/src/Symfony/Component/Routing/RequestContext.php index d522189cb0d51..d62a7766ef859 100644 --- a/src/Symfony/Component/Routing/RequestContext.php +++ b/src/Symfony/Component/Routing/RequestContext.php @@ -31,10 +31,6 @@ class RequestContext private $httpPort; private $httpsPort; private $queryString; - - /** - * @var array - */ private $parameters = array(); /** @@ -62,8 +58,6 @@ public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', /** * Updates the RequestContext information based on a HttpFoundation Request. * - * @param Request $request A Request instance - * * @return $this */ public function fromRequest(Request $request) diff --git a/src/Symfony/Component/Routing/RequestContextAwareInterface.php b/src/Symfony/Component/Routing/RequestContextAwareInterface.php index ebb0ef46ede28..df5b9fcd4712e 100644 --- a/src/Symfony/Component/Routing/RequestContextAwareInterface.php +++ b/src/Symfony/Component/Routing/RequestContextAwareInterface.php @@ -15,8 +15,6 @@ interface RequestContextAwareInterface { /** * Sets the request context. - * - * @param RequestContext $context The context */ public function setContext(RequestContext $context); diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index dd4eb840c2385..4f84c41ca3887 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -19,51 +19,20 @@ */ class Route implements \Serializable { - /** - * @var string - */ private $path = '/'; - - /** - * @var string - */ private $host = ''; - - /** - * @var string[] - */ private $schemes = array(); - - /** - * @var string[] - */ private $methods = array(); - - /** - * @var array - */ private $defaults = array(); - - /** - * @var array - */ private $requirements = array(); - - /** - * @var array - */ private $options = array(); + private $condition = ''; /** * @var null|CompiledRoute */ private $compiled; - /** - * @var string - */ - private $condition = ''; - /** * Available options: * diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php index c6229cfde2dee..feabf234bc6d4 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -116,8 +116,6 @@ public function remove($name) /** * Adds a route collection at the end of the current set by appending all * routes of the added collection. - * - * @param RouteCollection $collection A RouteCollection instance */ public function addCollection(RouteCollection $collection) { @@ -270,8 +268,6 @@ public function getResources() /** * Adds a resource for this collection. If the resource already exists * it is not added. - * - * @param ResourceInterface $resource A resource instance */ public function addResource(ResourceInterface $resource) { diff --git a/src/Symfony/Component/Routing/RouteCollectionBuilder.php b/src/Symfony/Component/Routing/RouteCollectionBuilder.php index 6044ca99d3d1f..78474cc5d2f97 100644 --- a/src/Symfony/Component/Routing/RouteCollectionBuilder.php +++ b/src/Symfony/Component/Routing/RouteCollectionBuilder.php @@ -38,9 +38,6 @@ class RouteCollectionBuilder private $methods; private $resources = array(); - /** - * @param LoaderInterface $loader - */ public function __construct(LoaderInterface $loader = null) { $this->loader = $loader; @@ -318,10 +315,10 @@ public function build() $routeCollection->addCollection($subCollection); } + } - foreach ($this->resources as $resource) { - $routeCollection->addResource($resource); - } + foreach ($this->resources as $resource) { + $routeCollection->addResource($resource); } return $routeCollection; diff --git a/src/Symfony/Component/Routing/RouteCompilerInterface.php b/src/Symfony/Component/Routing/RouteCompilerInterface.php index e6f8ee6deacc9..ddfa7ca49244b 100644 --- a/src/Symfony/Component/Routing/RouteCompilerInterface.php +++ b/src/Symfony/Component/Routing/RouteCompilerInterface.php @@ -21,8 +21,6 @@ interface RouteCompilerInterface /** * Compiles the current route instance. * - * @param Route $route A Route instance - * * @return CompiledRoute A CompiledRoute instance * * @throws \LogicException If the Route cannot be compiled because the diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index e93cd65ca2b84..0de921853f875 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -226,8 +226,6 @@ public function getContext() /** * Sets the ConfigCache factory to use. - * - * @param ConfigCacheFactoryInterface $configCacheFactory The factory to use */ public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) { diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php index 058a100d1f689..6fc592affc607 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php @@ -12,7 +12,9 @@ namespace Symfony\Component\Routing\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\Loader\YamlFileLoader; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollectionBuilder; @@ -59,7 +61,18 @@ public function testImport() $this->assertCount(1, $addedCollection->getResources()); // make sure the routes were imported into the top-level builder + $routeCollection = $routes->build(); $this->assertCount(1, $routes->build()); + $this->assertCount(1, $routeCollection->getResources()); + } + + public function testImportAddResources() + { + $routeCollectionBuilder = new RouteCollectionBuilder(new YamlFileLoader(new FileLocator(array(__DIR__.'/Fixtures/')))); + $routeCollectionBuilder->import('file_resource.yml'); + $routeCollection = $routeCollectionBuilder->build(); + + $this->assertCount(1, $routeCollection->getResources()); } /** diff --git a/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php b/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php index 03b48e9eb6dde..6c9c4cbb37efa 100644 --- a/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php +++ b/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php @@ -26,8 +26,6 @@ interface AuthenticationTrustResolverInterface * * If null is passed, the method must return false. * - * @param TokenInterface $token - * * @return bool */ public function isAnonymous(TokenInterface $token = null); @@ -36,8 +34,6 @@ public function isAnonymous(TokenInterface $token = null); * Resolves whether the passed token implementation is authenticated * using remember-me capabilities. * - * @param TokenInterface $token - * * @return bool */ public function isRememberMe(TokenInterface $token = null); @@ -45,8 +41,6 @@ public function isRememberMe(TokenInterface $token = null); /** * Resolves whether the passed token implementation is fully authenticated. * - * @param TokenInterface $token - * * @return bool */ public function isFullFledged(TokenInterface $token = null); diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php index c54b64df87c21..8c4ee9a47562c 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Core\Authentication\Provider; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; @@ -44,7 +45,7 @@ public function __construct($secret) public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { - return; + throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php b/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php index f3e1590bd4381..55514c16bf055 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php @@ -34,8 +34,6 @@ interface AuthenticationProviderInterface extends AuthenticationManagerInterface /** * Checks whether this provider supports the given token. * - * @param TokenInterface $token A TokenInterface instance - * * @return bool true if the implementation supports the Token, false otherwise */ public function supports(TokenInterface $token); diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php index b871f1f5a3591..2ed4d8fc9504c 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php @@ -13,6 +13,7 @@ use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; @@ -33,11 +34,6 @@ class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderIn private $userChecker; private $providerKey; - /** - * @param UserProviderInterface $userProvider An UserProviderInterface instance - * @param UserCheckerInterface $userChecker An UserCheckerInterface instance - * @param string $providerKey The provider key - */ public function __construct(UserProviderInterface $userProvider, UserCheckerInterface $userChecker, $providerKey) { $this->userProvider = $userProvider; @@ -51,7 +47,7 @@ public function __construct(UserProviderInterface $userProvider, UserCheckerInte public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { - return; + throw new AuthenticationException('The token is not supported by this authentication provider.'); } if (!$user = $token->getUser()) { diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php index 397dd61111ac4..f8ba7476ba278 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php @@ -14,6 +14,7 @@ use Symfony\Component\Security\Core\User\UserCheckerInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\BadCredentialsException; class RememberMeAuthenticationProvider implements AuthenticationProviderInterface @@ -40,7 +41,7 @@ public function __construct(UserCheckerInterface $userChecker, $secret, $provide public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { - return; + throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { @@ -49,6 +50,7 @@ public function authenticate(TokenInterface $token) $user = $token->getUser(); $this->userChecker->checkPreAuth($user); + $this->userChecker->checkPostAuth($user); $authenticatedToken = new RememberMeToken($user, $this->providerKey, $this->secret); $authenticatedToken->setAttributes($token->getAttributes()); diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php index 738c09c427632..9244a2eacf1d8 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php @@ -56,7 +56,7 @@ public function __construct(UserCheckerInterface $userChecker, $providerKey, $hi public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { - return; + throw new AuthenticationException('The token is not supported by this authentication provider.'); } $username = $token->getUsername(); @@ -108,9 +108,6 @@ public function supports(TokenInterface $token) /** * Retrieves roles from user and appends SwitchUserRole if original token contained one. * - * @param UserInterface $user The user - * @param TokenInterface $token The token - * * @return array The user roles */ private function getRoles(UserInterface $user, TokenInterface $token) @@ -144,9 +141,6 @@ abstract protected function retrieveUser($username, UsernamePasswordToken $token * Does additional checks on the user and token (like validating the * credentials). * - * @param UserInterface $user The retrieved UserInterface instance - * @param UsernamePasswordToken $token The UsernamePasswordToken token to be authenticated - * * @throws AuthenticationException if the credentials could not be validated */ abstract protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token); diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php index c2d860e905a24..58ac22c2ec2bc 100644 --- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php +++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php @@ -51,8 +51,6 @@ public function updateToken($series, $tokenValue, \DateTime $lastUsed); /** * Creates a new token. - * - * @param PersistentTokenInterface $token */ public function createNewToken(PersistentTokenInterface $token); } diff --git a/src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php b/src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php index f2f59ea76d32c..7f99fbb05be4b 100644 --- a/src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php +++ b/src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php @@ -31,9 +31,6 @@ class AuthenticatedVoter implements VoterInterface private $authenticationTrustResolver; - /** - * @param AuthenticationTrustResolverInterface $authenticationTrustResolver - */ public function __construct(AuthenticationTrustResolverInterface $authenticationTrustResolver) { $this->authenticationTrustResolver = $authenticationTrustResolver; diff --git a/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php b/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php index b78cd9afcf74f..00633397d2d40 100644 --- a/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php +++ b/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php @@ -30,11 +30,6 @@ class ExpressionVoter implements VoterInterface private $trustResolver; private $roleHierarchy; - /** - * @param ExpressionLanguage $expressionLanguage - * @param AuthenticationTrustResolverInterface $trustResolver - * @param RoleHierarchyInterface|null $roleHierarchy - */ public function __construct(ExpressionLanguage $expressionLanguage, AuthenticationTrustResolverInterface $trustResolver, RoleHierarchyInterface $roleHierarchy = null) { $this->expressionLanguage = $expressionLanguage; diff --git a/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php b/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php index 8e1dbc852e746..38caa81a05f32 100644 --- a/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php +++ b/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php @@ -61,8 +61,6 @@ public function getEncoder($user) /** * Creates the actual encoder instance. * - * @param array $config - * * @return PasswordEncoderInterface * * @throws \InvalidArgumentException diff --git a/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php index b09604952e0ef..3efc8c6d48bb5 100644 --- a/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php @@ -20,14 +20,8 @@ */ class UserPasswordEncoder implements UserPasswordEncoderInterface { - /** - * @var EncoderFactoryInterface - */ private $encoderFactory; - /** - * @param EncoderFactoryInterface $encoderFactory The encoder factory - */ public function __construct(EncoderFactoryInterface $encoderFactory) { $this->encoderFactory = $encoderFactory; diff --git a/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php b/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php index 9b29f634b4c8a..034ab792ee360 100644 --- a/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php +++ b/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php @@ -34,11 +34,6 @@ public function getUser() return $this->user; } - /** - * Set the user. - * - * @param UserInterface $user - */ public function setUser(UserInterface $user) { $this->user = $user; diff --git a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php index 2b897c251302c..8beb87bdb81bc 100644 --- a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php @@ -33,11 +33,6 @@ public function getToken() return $this->token; } - /** - * Set the token. - * - * @param TokenInterface $token - */ public function setToken(TokenInterface $token) { $this->token = $token; diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php index 5ded85b073566..e6c0f6853a7ca 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php @@ -24,11 +24,15 @@ public function testSupports() $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); } + /** + * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException + * @expectedExceptionMessage The token is not supported by this authentication provider. + */ public function testAuthenticateWhenTokenIsNotSupported() { $provider = $this->getProvider('foo'); - $this->assertNull($provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); + $provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php index 5a78d0ebb9119..5a6b04d5b4862 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php @@ -36,11 +36,15 @@ public function testSupports() $this->assertFalse($provider->supports($token)); } + /** + * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException + * @expectedExceptionMessage The token is not supported by this authentication provider. + */ public function testAuthenticateWhenTokenIsNotSupported() { $provider = $this->getProvider(); - $this->assertNull($provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); + $provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php index 4865cb177d3bf..497f315c33202 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php @@ -26,12 +26,16 @@ public function testSupports() $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); } + /** + * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException + * @expectedExceptionMessage The token is not supported by this authentication provider. + */ public function testAuthenticateWhenTokenIsNotSupported() { $provider = $this->getProvider(); $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); - $this->assertNull($provider->authenticate($token)); + $provider->authenticate($token); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php index da6136f22151f..a08ca3f813c87 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php @@ -29,11 +29,15 @@ public function testSupports() $this->assertFalse($provider->supports($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); } + /** + * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException + * @expectedExceptionMessage The token is not supported by this authentication provider. + */ public function testAuthenticateWhenTokenIsNotSupported() { $provider = $this->getProvider(); - $this->assertNull($provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); + $provider->authenticate($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); } /** diff --git a/src/Symfony/Component/Security/Core/User/EquatableInterface.php b/src/Symfony/Component/Security/Core/User/EquatableInterface.php index c6082ce5019aa..4878637454cf4 100644 --- a/src/Symfony/Component/Security/Core/User/EquatableInterface.php +++ b/src/Symfony/Component/Security/Core/User/EquatableInterface.php @@ -29,8 +29,6 @@ interface EquatableInterface * Also implementation should consider that $user instance may implement * the extended user interface `AdvancedUserInterface`. * - * @param UserInterface $user - * * @return bool */ public function isEqualTo(UserInterface $user); diff --git a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php index ff68389c881b1..0af14e6a46999 100644 --- a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php @@ -47,8 +47,6 @@ public function __construct(array $users = array()) /** * Adds a new User to the provider. * - * @param UserInterface $user A UserInterface instance - * * @throws \LogicException */ public function createUser(UserInterface $user) diff --git a/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php b/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php index 62ea9f0b05e8f..a7c5f179f84c6 100644 --- a/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php +++ b/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php @@ -26,8 +26,6 @@ interface UserCheckerInterface /** * Checks the user account before authentication. * - * @param UserInterface $user a UserInterface instance - * * @throws AccountStatusException */ public function checkPreAuth(UserInterface $user); @@ -35,8 +33,6 @@ public function checkPreAuth(UserInterface $user); /** * Checks the user account after authentication. * - * @param UserInterface $user a UserInterface instance - * * @throws AccountStatusException */ public function checkPostAuth(UserInterface $user); diff --git a/src/Symfony/Component/Security/Core/User/UserProviderInterface.php b/src/Symfony/Component/Security/Core/User/UserProviderInterface.php index 9570edc2776ab..5867e83333c5c 100644 --- a/src/Symfony/Component/Security/Core/User/UserProviderInterface.php +++ b/src/Symfony/Component/Security/Core/User/UserProviderInterface.php @@ -55,8 +55,6 @@ public function loadUserByUsername($username); * object can just be merged into some internal array of users / identity * map. * - * @param UserInterface $user - * * @return UserInterface * * @throws UnsupportedUserException if the user is not supported diff --git a/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php b/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php index cdda543cc0aed..487df7558f95c 100644 --- a/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php +++ b/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php @@ -23,23 +23,9 @@ */ class CsrfTokenManager implements CsrfTokenManagerInterface { - /** - * @var TokenGeneratorInterface - */ private $generator; - - /** - * @var TokenStorageInterface - */ private $storage; - /** - * Creates a new CSRF provider using PHP's native session storage. - * - * @param TokenGeneratorInterface|null $generator The token generator - * @param TokenStorageInterface|null $storage The storage for storing - * generated CSRF tokens - */ public function __construct(TokenGeneratorInterface $generator = null, TokenStorageInterface $storage = null) { $this->generator = $generator ?: new UriSafeTokenGenerator(); diff --git a/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php b/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php index 5936b6440e4d0..a29c04fa7ab6f 100644 --- a/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php +++ b/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php @@ -59,8 +59,6 @@ public function removeToken($tokenId); /** * Returns whether the given CSRF token is valid. * - * @param CsrfToken $token A CSRF token - * * @return bool Returns true if the token is valid, false otherwise */ public function isTokenValid(CsrfToken $token); diff --git a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php index 0e2c7d91b2533..94ae8b0ce2eae 100644 --- a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php +++ b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php @@ -14,6 +14,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; use Symfony\Component\Security\Guard\GuardAuthenticatorHandler; use Symfony\Component\Security\Guard\AuthenticatorInterface; use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken; @@ -110,7 +111,7 @@ private function executeGuardAuthenticator($uniqueGuardKey, AuthenticatorInterfa $credentials = $guardAuthenticator->getCredentials($request); if (null === $credentials) { - throw new \UnexpectedValueException(sprintf('The return value of "%s::getCredentials()" must not be null. Return false from "%s::supports()" instead.', get_class($guardAuthenticator), get_class($guardAuthenticator))); + throw new \UnexpectedValueException(sprintf('The return value of "%1$s::getCredentials()" must not be null. Return false from "%1$s::supports()" instead.', get_class($guardAuthenticator))); } // create a token with the unique key, so that the provider knows which authenticator to use diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 8bec87c318d80..2a116e375d8a2 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -46,9 +46,6 @@ public function __construct(TokenStorageInterface $tokenStorage, EventDispatcher /** * Authenticates the given token in the system. - * - * @param TokenInterface $token - * @param Request $request */ public function authenticateWithToken(TokenInterface $token, Request $request) { @@ -62,15 +59,8 @@ public function authenticateWithToken(TokenInterface $token, Request $request) /** * Returns the "on success" response for the given GuardAuthenticator. - * - * @param TokenInterface $token - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The provider (i.e. firewall) key - * - * @return null|Response */ - public function handleAuthenticationSuccess(TokenInterface $token, Request $request, AuthenticatorInterface $guardAuthenticator, $providerKey) + public function handleAuthenticationSuccess(TokenInterface $token, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey): ?Response { $response = $guardAuthenticator->onAuthenticationSuccess($request, $token, $providerKey); @@ -89,15 +79,8 @@ public function handleAuthenticationSuccess(TokenInterface $token, Request $requ /** * Convenience method for authenticating the user and returning the * Response *if any* for success. - * - * @param UserInterface $user - * @param Request $request - * @param AuthenticatorInterface $authenticator - * @param string $providerKey The provider (i.e. firewall) key - * - * @return Response|null */ - public function authenticateUserAndHandleSuccess(UserInterface $user, Request $request, AuthenticatorInterface $authenticator, $providerKey) + public function authenticateUserAndHandleSuccess(UserInterface $user, Request $request, AuthenticatorInterface $authenticator, string $providerKey): ?Response { // create an authenticated token for the User $token = $authenticator->createAuthenticatedToken($user, $providerKey); @@ -111,15 +94,8 @@ public function authenticateUserAndHandleSuccess(UserInterface $user, Request $r /** * Handles an authentication failure and returns the Response for the * GuardAuthenticator. - * - * @param AuthenticationException $authenticationException - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The key of the firewall - * - * @return null|Response */ - public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, $providerKey) + public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey): ?Response { $token = $this->tokenStorage->getToken(); if ($token instanceof PostAuthenticationGuardToken && $providerKey === $token->getProviderKey()) { diff --git a/src/Symfony/Component/Security/Http/AccessMapInterface.php b/src/Symfony/Component/Security/Http/AccessMapInterface.php index 7d15feeb0c653..6b1e5c9383aff 100644 --- a/src/Symfony/Component/Security/Http/AccessMapInterface.php +++ b/src/Symfony/Component/Security/Http/AccessMapInterface.php @@ -25,8 +25,6 @@ interface AccessMapInterface /** * Returns security attributes and required channel for the supplied request. * - * @param Request $request The current request - * * @return array A tuple of security attributes and the required channel */ public function getPatterns(Request $request); diff --git a/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php b/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php index e2d375e7540e7..de7a1ca5eb322 100644 --- a/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php @@ -31,9 +31,6 @@ interface AuthenticationFailureHandlerInterface * called by authentication listeners inheriting from * AbstractAuthenticationListener. * - * @param Request $request - * @param AuthenticationException $exception - * * @return Response The response to return, never null */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception); diff --git a/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php b/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php index d0b3cb6f216ea..9ef863b1349ae 100644 --- a/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php @@ -31,9 +31,6 @@ interface AuthenticationSuccessHandlerInterface * is called by authentication listeners inheriting from * AbstractAuthenticationListener. * - * @param Request $request - * @param TokenInterface $token - * * @return Response never null */ public function onAuthenticationSuccess(Request $request, TokenInterface $token); diff --git a/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php b/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php index 0012d36a1fa00..32ea2b1c304bd 100644 --- a/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php +++ b/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php @@ -23,14 +23,8 @@ */ class AuthenticationUtils { - /** - * @var RequestStack - */ private $requestStack; - /** - * @param RequestStack $requestStack - */ public function __construct(RequestStack $requestStack) { $this->requestStack = $requestStack; diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php index 3d95eaadd9f91..6e932a2474e9a 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php @@ -66,11 +66,6 @@ public function getOptions() return $this->options; } - /** - * Sets the options. - * - * @param array $options An array of options - */ public function setOptions(array $options) { $this->options = array_merge($this->defaultOptions, $options); diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php index 43c28e12ba458..babf86b84b7e4 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -67,11 +67,6 @@ public function getOptions() return $this->options; } - /** - * Sets the options. - * - * @param array $options An array of options - */ public function setOptions(array $options) { $this->options = array_merge($this->defaultOptions, $options); @@ -100,8 +95,6 @@ public function setProviderKey($providerKey) /** * Builds the target URL according to the defined options. * - * @param Request $request - * * @return string */ protected function determineTargetUrl(Request $request) diff --git a/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php b/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php index a5ea9db6313bd..aea901181f601 100644 --- a/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php @@ -26,9 +26,6 @@ interface AccessDeniedHandlerInterface /** * Handles an access denied failure. * - * @param Request $request - * @param AccessDeniedException $accessDeniedException - * * @return Response may return null */ public function handle(Request $request, AccessDeniedException $accessDeniedException); diff --git a/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php b/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php index 17c6d9e8f78e7..d46b1d522ebf4 100644 --- a/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php +++ b/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php @@ -23,10 +23,6 @@ class InteractiveLoginEvent extends Event private $request; private $authenticationToken; - /** - * @param Request $request A Request instance - * @param TokenInterface $authenticationToken A TokenInterface instance - */ public function __construct(Request $request, TokenInterface $authenticationToken) { $this->request = $request; diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index 9cd8b8f470c60..28b56d5791bd4 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -33,10 +33,6 @@ class Firewall implements EventSubscriberInterface private $dispatcher; private $exceptionListeners; - /** - * @param FirewallMapInterface $map A FirewallMapInterface instance - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - */ public function __construct(FirewallMapInterface $map, EventDispatcherInterface $dispatcher) { $this->map = $map; @@ -44,11 +40,6 @@ public function __construct(FirewallMapInterface $map, EventDispatcherInterface $this->exceptionListeners = new \SplObjectStorage(); } - /** - * Handles security. - * - * @param GetResponseEvent $event An GetResponseEvent instance - */ public function onKernelRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 1056879e348f7..71a9311a93e3f 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -108,8 +108,6 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM /** * Sets the RememberMeServices implementation to use. - * - * @param RememberMeServicesInterface $rememberMeServices */ public function setRememberMeServices(RememberMeServicesInterface $rememberMeServices) { @@ -119,8 +117,6 @@ public function setRememberMeServices(RememberMeServicesInterface $rememberMeSer /** * Handles form based authentication. * - * @param GetResponseEvent $event A GetResponseEvent instance - * * @throws \RuntimeException * @throws SessionUnavailableException */ @@ -168,8 +164,6 @@ final public function handle(GetResponseEvent $event) * but a subclass could change this to only authenticate requests where a * certain parameters is present. * - * @param Request $request - * * @return bool */ protected function requiresAuthentication(Request $request) @@ -180,8 +174,6 @@ protected function requiresAuthentication(Request $request) /** * Performs authentication. * - * @param Request $request A Request instance - * * @return TokenInterface|Response|null The authenticated token, null if full authentication is not possible, or a Response * * @throws AuthenticationException if the authentication fails diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php index b793310d9b336..0065fe8237c3e 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php @@ -49,8 +49,6 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM /** * Handles pre-authentication. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ final public function handle(GetResponseEvent $event) { @@ -97,8 +95,6 @@ final public function handle(GetResponseEvent $event) /** * Clears a PreAuthenticatedToken for this provider (if present). - * - * @param AuthenticationException $exception */ private function clearToken(AuthenticationException $exception) { @@ -115,8 +111,6 @@ private function clearToken(AuthenticationException $exception) /** * Gets the user and credentials from the Request. * - * @param Request $request A Request instance - * * @return array An array composed of the user and the credentials */ abstract protected function getPreAuthenticatedData(Request $request); diff --git a/src/Symfony/Component/Security/Http/Firewall/AccessListener.php b/src/Symfony/Component/Security/Http/Firewall/AccessListener.php index 75798b9dd3b2e..ec5e217cba9a9 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AccessListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AccessListener.php @@ -42,8 +42,6 @@ public function __construct(TokenStorageInterface $tokenStorage, AccessDecisionM /** * Handles access authorization. * - * @param GetResponseEvent $event A GetResponseEvent instance - * * @throws AccessDeniedException * @throws AuthenticationCredentialsNotFoundException */ diff --git a/src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php index 0d60673a49c50..3f4de13df54b9 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php @@ -41,8 +41,6 @@ public function __construct(TokenStorageInterface $tokenStorage, $secret, Logger /** * Handles anonymous authentication. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php index 5bbf13d9b8434..1ddc41643448e 100644 --- a/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php @@ -49,8 +49,6 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM /** * Handles basic authentication. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php b/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php index 637a7f5492e5f..d0fff21574354 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php @@ -37,8 +37,6 @@ public function __construct(AccessMapInterface $map, AuthenticationEntryPointInt /** * Handles channel management. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 7c762032aa151..79218f7a43dcc 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -79,8 +79,6 @@ public function setLogoutOnUserChange($logoutOnUserChange) /** * Reads the Security Token from the session. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ public function handle(GetResponseEvent $event) { @@ -122,8 +120,6 @@ public function handle(GetResponseEvent $event) /** * Writes the security token into the session. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance */ public function onKernelResponse(FilterResponseEvent $event) { @@ -157,8 +153,6 @@ public function onKernelResponse(FilterResponseEvent $event) /** * Refreshes the user by reloading it from the user provider. * - * @param TokenInterface $token - * * @return TokenInterface|null * * @throws \RuntimeException diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index 2091c84f60ebe..756d1851d12f1 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -67,8 +67,6 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationT /** * Registers a onKernelException listener to take care of security exceptions. - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance */ public function register(EventDispatcherInterface $dispatcher) { @@ -77,8 +75,6 @@ public function register(EventDispatcherInterface $dispatcher) /** * Unregisters the dispatcher. - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance */ public function unregister(EventDispatcherInterface $dispatcher) { @@ -87,8 +83,6 @@ public function unregister(EventDispatcherInterface $dispatcher) /** * Handles security related exceptions. - * - * @param GetResponseForExceptionEvent $event An GetResponseForExceptionEvent instance */ public function onKernelException(GetResponseForExceptionEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php b/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php index 0fc8d11c3aee5..d881badd01f1c 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php +++ b/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php @@ -20,10 +20,5 @@ */ interface ListenerInterface { - /** - * This interface must be implemented by firewall listeners. - * - * @param GetResponseEvent $event - */ public function handle(GetResponseEvent $event); } diff --git a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php index 661af497c2840..21819ce4a9968 100644 --- a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php @@ -58,11 +58,6 @@ public function __construct(TokenStorageInterface $tokenStorage, HttpUtils $http $this->handlers = array(); } - /** - * Adds a logout handler. - * - * @param LogoutHandlerInterface $handler - */ public function addHandler(LogoutHandlerInterface $handler) { $this->handlers[] = $handler; @@ -74,8 +69,6 @@ public function addHandler(LogoutHandlerInterface $handler) * If a CsrfTokenManagerInterface instance is available, it will be used to * validate the request. * - * @param GetResponseEvent $event A GetResponseEvent instance - * * @throws LogoutException if the CSRF token is invalid * @throws \RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response */ @@ -119,8 +112,6 @@ public function handle(GetResponseEvent $event) * but a subclass could change this to logout requests where * certain parameters is present. * - * @param Request $request - * * @return bool */ protected function requiresLogout(Request $request) diff --git a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php index 0fa23cfabe7ee..13cb8755dfacd 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php @@ -60,8 +60,6 @@ public function __construct(TokenStorageInterface $tokenStorage, RememberMeServi /** * Handles remember-me cookie based authentication. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php index aaeeb368fbaba..dd90712408615 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php @@ -63,8 +63,6 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM /** * Handles basic authentication. - * - * @param GetResponseEvent $event A GetResponseEvent instance */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php index 426727a738365..0a0f33441398d 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php @@ -72,8 +72,6 @@ public function __construct(TokenStorageInterface $tokenStorage, UserProviderInt /** * Handles the switch to another user. * - * @param GetResponseEvent $event A GetResponseEvent instance - * * @throws \LogicException if switching to a user failed */ public function handle(GetResponseEvent $event) @@ -160,8 +158,6 @@ private function attemptSwitchUser(Request $request, $username) /** * Attempts to exit from an already switched user. * - * @param Request $request A Request instance - * * @return TokenInterface The original TokenInterface instance * * @throws AuthenticationCredentialsNotFoundException @@ -185,8 +181,6 @@ private function attemptExitUser(Request $request) /** * Gets the original Token from a switched one. * - * @param TokenInterface $token A switched TokenInterface instance - * * @return TokenInterface|false The original TokenInterface instance, false if the current TokenInterface is not switched */ private function getOriginalToken(TokenInterface $token) diff --git a/src/Symfony/Component/Security/Http/FirewallMap.php b/src/Symfony/Component/Security/Http/FirewallMap.php index 1bb73bd2932b4..e767d123cb03e 100644 --- a/src/Symfony/Component/Security/Http/FirewallMap.php +++ b/src/Symfony/Component/Security/Http/FirewallMap.php @@ -25,11 +25,6 @@ class FirewallMap implements FirewallMapInterface { private $map = array(); - /** - * @param RequestMatcherInterface $requestMatcher - * @param array $listeners - * @param ExceptionListener $exceptionListener - */ public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = array(), ExceptionListener $exceptionListener = null) { $this->map[] = array($requestMatcher, $listeners, $exceptionListener); diff --git a/src/Symfony/Component/Security/Http/FirewallMapInterface.php b/src/Symfony/Component/Security/Http/FirewallMapInterface.php index 1627ab5956d0d..ebdd498123a1c 100644 --- a/src/Symfony/Component/Security/Http/FirewallMapInterface.php +++ b/src/Symfony/Component/Security/Http/FirewallMapInterface.php @@ -30,8 +30,6 @@ interface FirewallMapInterface * If there is no exception listener, the second element of the outer array * must be null. * - * @param Request $request - * * @return array of the format array(array(AuthenticationListener), ExceptionListener) */ public function getListeners(Request $request); diff --git a/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php b/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php index a78b25f0c34ec..b96bc43a78d5d 100644 --- a/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php +++ b/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php @@ -34,10 +34,6 @@ public function __construct(array $cookies) /** * Implementation for the LogoutHandlerInterface. Deletes all requested cookies. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token */ public function logout(Request $request, Response $response, TokenInterface $token) { diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php b/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php index 5e1cea81df991..363bc4abe1630 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php @@ -26,10 +26,6 @@ interface LogoutHandlerInterface * This method is called by the LogoutListener when a user has requested * to be logged out. Usually, you would unset session variables, or remove * cookies, etc. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token */ public function logout(Request $request, Response $response, TokenInterface $token); } diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php b/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php index 4246fa4414543..c320ad655f278 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php @@ -30,8 +30,6 @@ interface LogoutSuccessHandlerInterface /** * Creates a Response object to send upon a successful logout. * - * @param Request $request - * * @return Response never null */ public function onLogoutSuccess(Request $request); diff --git a/src/Symfony/Component/Security/Http/Logout/SessionLogoutHandler.php b/src/Symfony/Component/Security/Http/Logout/SessionLogoutHandler.php index e036c5fa6b62f..7f362de9d7a2b 100644 --- a/src/Symfony/Component/Security/Http/Logout/SessionLogoutHandler.php +++ b/src/Symfony/Component/Security/Http/Logout/SessionLogoutHandler.php @@ -24,10 +24,6 @@ class SessionLogoutHandler implements LogoutHandlerInterface { /** * Invalidate the current session. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token */ public function logout(Request $request, Response $response, TokenInterface $token) { diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php index 1f0a9d816792c..afff015ed47b9 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php @@ -94,8 +94,6 @@ public function getSecret() * Implementation of RememberMeServicesInterface. Detects whether a remember-me * cookie was set, decodes it, and hands it to subclasses for further processing. * - * @param Request $request - * * @return TokenInterface|null * * @throws CookieTheftException @@ -156,10 +154,6 @@ final public function autoLogin(Request $request) /** * Implementation for LogoutHandlerInterface. Deletes the cookie. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token */ public function logout(Request $request, Response $response, TokenInterface $token) { @@ -169,9 +163,6 @@ public function logout(Request $request, Response $response, TokenInterface $tok /** * Implementation for RememberMeServicesInterface. Deletes the cookie when * an attempted authentication fails. - * - * @param Request $request - * @param \Exception|null $exception */ final public function loginFail(Request $request, \Exception $exception = null) { @@ -182,10 +173,6 @@ final public function loginFail(Request $request, \Exception $exception = null) /** * Implementation for RememberMeServicesInterface. This is called when an * authentication is successful. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token The token that resulted in a successful authentication */ final public function loginSuccess(Request $request, Response $response, TokenInterface $token) { @@ -225,17 +212,10 @@ final public function loginSuccess(Request $request, Response $response, TokenIn * Subclasses should validate the cookie and do any additional processing * that is required. This is called from autoLogin(). * - * @param array $cookieParts - * @param Request $request - * * @return UserInterface */ abstract protected function processAutoLoginCookie(array $cookieParts, Request $request); - /** - * @param Request $request - * @param \Exception|null $exception - */ protected function onLoginFail(Request $request, \Exception $exception = null) { } @@ -244,10 +224,6 @@ protected function onLoginFail(Request $request, \Exception $exception = null) * This is called after a user has been logged in successfully, and has * requested remember-me capabilities. The implementation usually sets a * cookie and possibly stores a persistent record of it. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token */ abstract protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token); @@ -277,8 +253,6 @@ protected function decodeCookie($rawCookie) /** * Encodes the cookie parts. * - * @param array $cookieParts - * * @return string * * @throws \InvalidArgumentException When $cookieParts contain the cookie delimiter. Extending class should either remove or escape it. @@ -296,8 +270,6 @@ protected function encodeCookie(array $cookieParts) /** * Deletes the remember-me cookie. - * - * @param Request $request */ protected function cancelCookie(Request $request) { @@ -311,8 +283,6 @@ protected function cancelCookie(Request $request) /** * Checks whether remember-me capabilities were requested. * - * @param Request $request - * * @return bool */ protected function isRememberMeRequested(Request $request) diff --git a/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php index 5c8fa7ce388bc..d18c356164815 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php @@ -32,11 +32,6 @@ class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices /** @var TokenProviderInterface */ private $tokenProvider; - /** - * Sets the token provider. - * - * @param TokenProviderInterface $tokenProvider - */ public function setTokenProvider(TokenProviderInterface $tokenProvider) { $this->tokenProvider = $tokenProvider; diff --git a/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php b/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php index 80ea2fd4b0ad4..2084456c1117b 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php +++ b/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php @@ -48,8 +48,6 @@ interface RememberMeServicesInterface * make sure to throw an AuthenticationException as this will consequentially * result in a call to loginFail() and therefore an invalidation of the cookie. * - * @param Request $request - * * @return TokenInterface */ public function autoLogin(Request $request); @@ -59,9 +57,6 @@ public function autoLogin(Request $request); * credentials supplied by the user were missing or otherwise invalid. * * This method needs to take care of invalidating the cookie. - * - * @param Request $request - * @param \Exception|null $exception */ public function loginFail(Request $request, \Exception $exception = null); @@ -75,10 +70,6 @@ public function loginFail(Request $request, \Exception $exception = null); * Instead, implementations should typically look for a request parameter * (such as a HTTP POST parameter) that indicates the browser has explicitly * requested for the authentication to be remembered. - * - * @param Request $request - * @param Response $response - * @param TokenInterface $token */ public function loginSuccess(Request $request, Response $response, TokenInterface $token); } diff --git a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php index 4149fb6d85d85..e8c4424ac79e5 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php +++ b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php @@ -22,9 +22,6 @@ */ class ResponseListener implements EventSubscriberInterface { - /** - * @param FilterResponseEvent $event - */ public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { diff --git a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php index dd0c38184e6cd..9b05f151340ee 100644 --- a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php +++ b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php @@ -29,9 +29,6 @@ interface SessionAuthenticationStrategyInterface * * This method is called before the TokenStorage is populated with a * Token, and only by classes inheriting from AbstractAuthenticationListener. - * - * @param Request $request - * @param TokenInterface $token */ public function onAuthentication(Request $request, TokenInterface $token); } diff --git a/src/Symfony/Component/Serializer/Annotation/Groups.php b/src/Symfony/Component/Serializer/Annotation/Groups.php index b67239bc6f219..432f7f9efcb57 100644 --- a/src/Symfony/Component/Serializer/Annotation/Groups.php +++ b/src/Symfony/Component/Serializer/Annotation/Groups.php @@ -29,8 +29,6 @@ class Groups private $groups; /** - * @param array $data - * * @throws InvalidArgumentException */ public function __construct(array $data) diff --git a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php index c44510f60603b..545841fffd48b 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php @@ -57,14 +57,9 @@ public function supportsDecoding($format, array $context = array()) /** * Gets the decoder supporting the format. * - * @param string $format - * @param array $context - * - * @return DecoderInterface - * * @throws RuntimeException if no decoder is found */ - private function getDecoder($format, array $context) + private function getDecoder(string $format, array $context): DecoderInterface { if (isset($this->decoderByFormat[$format]) && isset($this->decoders[$this->decoderByFormat[$format]]) diff --git a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php index ae12cc9f29166..2737f6eba695f 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php @@ -80,14 +80,9 @@ public function needsNormalization($format, array $context = array()) /** * Gets the encoder supporting the format. * - * @param string $format - * @param array $context - * - * @return EncoderInterface - * * @throws RuntimeException if no encoder is found */ - private function getEncoder($format, array $context) + private function getEncoder(string $format, array $context): EncoderInterface { if (isset($this->encoderByFormat[$format]) && isset($this->encoders[$this->encoderByFormat[$format]]) diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php index 30487a8414d1e..218f4008fb45e 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -105,8 +105,6 @@ public function supportsDecoding($format) /** * Merges the default options of the Json Decoder with the passed context. * - * @param array $context - * * @return array */ private function resolveContext(array $context) diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index 5ed9ae7a255b7..ca42abc5a465d 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -57,8 +57,6 @@ public function supportsEncoding($format) /** * Merge default json encode options with context. * - * @param array $context - * * @return array */ private function resolveContext(array $context = array()) diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 013dacce3fee7..93122b6c52a16 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -521,8 +521,6 @@ private function selectNodeType(\DOMNode $node, $val) /** * Get real XML root node name, taking serializer options into account. * - * @param array $context - * * @return string */ private function resolveXmlRootName(array $context = array()) diff --git a/src/Symfony/Component/Serializer/Encoder/YamlEncoder.php b/src/Symfony/Component/Serializer/Encoder/YamlEncoder.php index 41ac04f209105..3ac1af679a4a1 100644 --- a/src/Symfony/Component/Serializer/Encoder/YamlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/YamlEncoder.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Encoder; +use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; @@ -29,6 +30,10 @@ class YamlEncoder implements EncoderInterface, DecoderInterface public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array()) { + if (!class_exists(Dumper::class)) { + throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.'); + } + $this->dumper = $dumper ?: new Dumper(); $this->parser = $parser ?: new Parser(); $this->defaultContext = array_merge($this->defaultContext, $defaultContext); diff --git a/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php b/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php index b9daf5d25b829..5888234a4c285 100644 --- a/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php +++ b/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php @@ -19,8 +19,6 @@ class AttributeMetadata implements AttributeMetadataInterface { /** - * @var string - * * @internal This property is public in order to reduce the size of the * class' serialized representation. Do not access it. Use * {@link getName()} instead. @@ -28,8 +26,6 @@ class AttributeMetadata implements AttributeMetadataInterface public $name; /** - * @var array - * * @internal This property is public in order to reduce the size of the * class' serialized representation. Do not access it. Use * {@link getGroups()} instead. diff --git a/src/Symfony/Component/Serializer/Mapping/AttributeMetadataInterface.php b/src/Symfony/Component/Serializer/Mapping/AttributeMetadataInterface.php index abba8c1969799..944a7b3133f35 100644 --- a/src/Symfony/Component/Serializer/Mapping/AttributeMetadataInterface.php +++ b/src/Symfony/Component/Serializer/Mapping/AttributeMetadataInterface.php @@ -59,8 +59,6 @@ public function getMaxDepth(); /** * Merges an {@see AttributeMetadataInterface} with in the current one. - * - * @param AttributeMetadataInterface $attributeMetadata */ public function merge(AttributeMetadataInterface $attributeMetadata); } diff --git a/src/Symfony/Component/Serializer/Mapping/ClassMetadataInterface.php b/src/Symfony/Component/Serializer/Mapping/ClassMetadataInterface.php index c00981b64f069..3811e56548a0c 100644 --- a/src/Symfony/Component/Serializer/Mapping/ClassMetadataInterface.php +++ b/src/Symfony/Component/Serializer/Mapping/ClassMetadataInterface.php @@ -33,8 +33,6 @@ public function getName(); /** * Adds an {@link AttributeMetadataInterface}. - * - * @param AttributeMetadataInterface $attributeMetadata */ public function addAttributeMetadata(AttributeMetadataInterface $attributeMetadata); @@ -47,8 +45,6 @@ public function getAttributesMetadata(); /** * Merges a {@link ClassMetadataInterface} in the current one. - * - * @param ClassMetadataInterface $classMetadata */ public function merge(ClassMetadataInterface $classMetadata); diff --git a/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php b/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php index 448e61a6b6342..ce376010e5584 100644 --- a/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php +++ b/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php @@ -24,9 +24,6 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface { use ClassResolverTrait; - /** - * @var LoaderInterface - */ private $loader; /** diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/AnnotationLoader.php b/src/Symfony/Component/Serializer/Mapping/Loader/AnnotationLoader.php index 4495f0d56c3bf..5527b5f71731e 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/AnnotationLoader.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/AnnotationLoader.php @@ -25,14 +25,8 @@ */ class AnnotationLoader implements LoaderInterface { - /** - * @var Reader - */ private $reader; - /** - * @param Reader $reader - */ public function __construct(Reader $reader) { $this->reader = $reader; diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/LoaderInterface.php b/src/Symfony/Component/Serializer/Mapping/Loader/LoaderInterface.php index ebf84b6a96130..1310a71698805 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/LoaderInterface.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/LoaderInterface.php @@ -21,10 +21,6 @@ interface LoaderInterface { /** - * Load class metadata. - * - * @param ClassMetadataInterface $classMetadata A metadata - * * @return bool */ public function loadClassMetadata(ClassMetadataInterface $classMetadata); diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index d6b0db03ef74c..77262cc53aaa4 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -73,9 +73,6 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn /** * Sets the {@link ClassMetadataFactoryInterface} to use. - * - * @param ClassMetadataFactoryInterface|null $classMetadataFactory - * @param NameConverterInterface|null $nameConverter */ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null) { @@ -138,8 +135,6 @@ public function setCallbacks(array $callbacks) /** * Set ignored attributes for normalization and denormalization. * - * @param array $ignoredAttributes - * * @return self */ public function setIgnoredAttributes(array $ignoredAttributes) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 93e5f9bc5e126..c63f5dee5eae4 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -110,7 +110,7 @@ public function normalize($object, $format = null, array $context = array()) * * @return string[] */ - protected function getAttributes($object, $format = null, array $context) + protected function getAttributes($object, $format, array $context) { $class = get_class($object); $key = $class.'-'.$context['cache_key']; diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 87fdfca11c735..dac7f06218b2c 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -15,6 +15,7 @@ use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; +use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; @@ -32,6 +33,10 @@ class ObjectNormalizer extends AbstractObjectNormalizer public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null) { + if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) { + throw new RuntimeException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.'); + } + parent::__construct($classMetadataFactory, $nameConverter, $propertyTypeExtractor); $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); diff --git a/src/Symfony/Component/Serializer/SerializerAwareInterface.php b/src/Symfony/Component/Serializer/SerializerAwareInterface.php index dd0a62e7fa887..13dfb392e9688 100644 --- a/src/Symfony/Component/Serializer/SerializerAwareInterface.php +++ b/src/Symfony/Component/Serializer/SerializerAwareInterface.php @@ -20,8 +20,6 @@ interface SerializerAwareInterface { /** * Sets the owning Serializer object. - * - * @param SerializerInterface $serializer */ public function setSerializer(SerializerInterface $serializer); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php index 3e5c31ea83658..82c64cc149c63 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\ChainEncoder; +use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface; class ChainEncoderTest extends TestCase @@ -123,10 +124,14 @@ class ChainNormalizationAwareEncoder extends ChainEncoder implements Normalizati { } -class NormalizationAwareEncoder implements NormalizationAwareInterface +class NormalizationAwareEncoder implements EncoderInterface, NormalizationAwareInterface { public function supportsEncoding($format) { return true; } + + public function encode($data, $format, array $context = array()) + { + } } diff --git a/src/Symfony/Component/Templating/DelegatingEngine.php b/src/Symfony/Component/Templating/DelegatingEngine.php index bef82af7bd21b..b47a0f0620369 100644 --- a/src/Symfony/Component/Templating/DelegatingEngine.php +++ b/src/Symfony/Component/Templating/DelegatingEngine.php @@ -62,11 +62,6 @@ public function exists($name) return $this->getEngine($name)->exists($name); } - /** - * Adds an engine. - * - * @param EngineInterface $engine An EngineInterface instance - */ public function addEngine(EngineInterface $engine) { $this->engines[] = $engine; diff --git a/src/Symfony/Component/Templating/Loader/CacheLoader.php b/src/Symfony/Component/Templating/Loader/CacheLoader.php index a970847a746b1..b17461c5ee8fb 100644 --- a/src/Symfony/Component/Templating/Loader/CacheLoader.php +++ b/src/Symfony/Component/Templating/Loader/CacheLoader.php @@ -42,8 +42,6 @@ public function __construct(LoaderInterface $loader, $dir) /** * Loads a template. * - * @param TemplateReferenceInterface $template A template - * * @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise */ public function load(TemplateReferenceInterface $template) diff --git a/src/Symfony/Component/Templating/Loader/ChainLoader.php b/src/Symfony/Component/Templating/Loader/ChainLoader.php index ea9aac5f77174..d66139e0b3ffa 100644 --- a/src/Symfony/Component/Templating/Loader/ChainLoader.php +++ b/src/Symfony/Component/Templating/Loader/ChainLoader.php @@ -35,8 +35,6 @@ public function __construct(array $loaders = array()) /** * Adds a loader instance. - * - * @param LoaderInterface $loader A Loader instance */ public function addLoader(LoaderInterface $loader) { @@ -46,8 +44,6 @@ public function addLoader(LoaderInterface $loader) /** * Loads a template. * - * @param TemplateReferenceInterface $template A template - * * @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise */ public function load(TemplateReferenceInterface $template) diff --git a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php index e5b2be5218e68..80905f315c783 100644 --- a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php +++ b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php @@ -35,8 +35,6 @@ public function __construct($templatePathPatterns) /** * Loads a template. * - * @param TemplateReferenceInterface $template A template - * * @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise */ public function load(TemplateReferenceInterface $template) diff --git a/src/Symfony/Component/Templating/Loader/Loader.php b/src/Symfony/Component/Templating/Loader/Loader.php index 7820444fca33c..7a27665d7f89c 100644 --- a/src/Symfony/Component/Templating/Loader/Loader.php +++ b/src/Symfony/Component/Templating/Loader/Loader.php @@ -27,8 +27,6 @@ abstract class Loader implements LoaderInterface /** * Sets the debug logger to use for this loader. - * - * @param LoggerInterface $logger A logger instance */ public function setLogger(LoggerInterface $logger) { diff --git a/src/Symfony/Component/Templating/Loader/LoaderInterface.php b/src/Symfony/Component/Templating/Loader/LoaderInterface.php index 0795dcbd19392..d2897e5c20340 100644 --- a/src/Symfony/Component/Templating/Loader/LoaderInterface.php +++ b/src/Symfony/Component/Templating/Loader/LoaderInterface.php @@ -24,8 +24,6 @@ interface LoaderInterface /** * Loads a template. * - * @param TemplateReferenceInterface $template A template - * * @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise */ public function load(TemplateReferenceInterface $template); diff --git a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php index bb501c14a465c..022bad48f8522 100644 --- a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php +++ b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php @@ -26,19 +26,8 @@ */ abstract class AbstractOperation implements OperationInterface { - /** - * @var MessageCatalogueInterface The source catalogue - */ protected $source; - - /** - * @var MessageCatalogueInterface The target catalogue - */ protected $target; - - /** - * @var MessageCatalogue The result catalogue - */ protected $result; /** @@ -71,9 +60,6 @@ abstract class AbstractOperation implements OperationInterface protected $messages; /** - * @param MessageCatalogueInterface $source The source catalogue - * @param MessageCatalogueInterface $target The target catalogue - * * @throws LogicException */ public function __construct(MessageCatalogueInterface $source, MessageCatalogueInterface $target) diff --git a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php index da45cce31e659..5d97a67006119 100644 --- a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php +++ b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php @@ -22,14 +22,8 @@ */ class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface { - /** - * @var DataCollectorTranslator - */ private $translator; - /** - * @param DataCollectorTranslator $translator - */ public function __construct(DataCollectorTranslator $translator) { $this->translator = $translator; diff --git a/src/Symfony/Component/Translation/DataCollectorTranslator.php b/src/Symfony/Component/Translation/DataCollectorTranslator.php index 48b3c473c5670..715c390f531d8 100644 --- a/src/Symfony/Component/Translation/DataCollectorTranslator.php +++ b/src/Symfony/Component/Translation/DataCollectorTranslator.php @@ -27,9 +27,6 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter */ private $translator; - /** - * @var array - */ private $messages = array(); /** diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index fa6f877f8a645..7ce7d2dfffe1f 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -123,9 +123,6 @@ protected function loadResource($resource) * * A .po file could contain by error missing plural indexes. We need to * fix these before saving them. - * - * @param array $messages - * @param array $item */ private function addMessage(array &$messages, array $item) { diff --git a/src/Symfony/Component/Translation/MessageCatalogueInterface.php b/src/Symfony/Component/Translation/MessageCatalogueInterface.php index 40054f05c4c18..4dad27fbf6aa3 100644 --- a/src/Symfony/Component/Translation/MessageCatalogueInterface.php +++ b/src/Symfony/Component/Translation/MessageCatalogueInterface.php @@ -104,8 +104,6 @@ public function add($messages, $domain = 'messages'); * Merges translations from the given Catalogue into the current one. * * The two catalogues must have the same locale. - * - * @param self $catalogue */ public function addCatalogue(MessageCatalogueInterface $catalogue); @@ -114,8 +112,6 @@ public function addCatalogue(MessageCatalogueInterface $catalogue); * only when the translation does not exist. * * This is used to provide default translations when they do not exist for the current locale. - * - * @param self $catalogue */ public function addFallbackCatalogue(MessageCatalogueInterface $catalogue); @@ -135,8 +131,6 @@ public function getResources(); /** * Adds a resource for this collection. - * - * @param ResourceInterface $resource A resource instance */ public function addResource(ResourceInterface $resource); } diff --git a/src/Symfony/Component/Translation/PluralizationRules.php b/src/Symfony/Component/Translation/PluralizationRules.php index 4f2c2b4f9b03c..38dde743acc4f 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -71,7 +71,6 @@ public static function get($number, $locale) case 'vi': case 'zh': return 0; - break; case 'af': case 'bn': diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index cc76d4f5fa17a..745d6a790a346 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -94,11 +94,6 @@ public function __construct($locale, MessageFormatterInterface $formatter = null $this->debug = $debug; } - /** - * Sets the ConfigCache factory to use. - * - * @param ConfigCacheFactoryInterface $configCacheFactory - */ public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) { $this->configCacheFactory = $configCacheFactory; diff --git a/src/Symfony/Component/Translation/Writer/TranslationWriter.php b/src/Symfony/Component/Translation/Writer/TranslationWriter.php index fa28e739309bd..56d99cc7729c5 100644 --- a/src/Symfony/Component/Translation/Writer/TranslationWriter.php +++ b/src/Symfony/Component/Translation/Writer/TranslationWriter.php @@ -23,11 +23,6 @@ */ class TranslationWriter implements TranslationWriterInterface { - /** - * Dumpers used for export. - * - * @var array - */ private $dumpers = array(); /** diff --git a/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php b/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php index 5e216275b4933..b647645621899 100644 --- a/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php +++ b/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php @@ -21,8 +21,6 @@ interface ConstraintValidatorFactoryInterface * Given a Constraint, this returns the ConstraintValidatorInterface * object that should be used to verify its validity. * - * @param Constraint $constraint The source constraint - * * @return ConstraintValidatorInterface */ public function getInstance(Constraint $constraint); diff --git a/src/Symfony/Component/Validator/ConstraintViolation.php b/src/Symfony/Component/Validator/ConstraintViolation.php index 015aa741dd9e4..97c1f1c1aac60 100644 --- a/src/Symfony/Component/Validator/ConstraintViolation.php +++ b/src/Symfony/Component/Validator/ConstraintViolation.php @@ -18,54 +18,15 @@ */ class ConstraintViolation implements ConstraintViolationInterface { - /** - * @var string - */ private $message; - - /** - * @var string - */ private $messageTemplate; - - /** - * @var array - */ private $parameters; - - /** - * @var int|null - */ private $plural; - - /** - * @var mixed - */ private $root; - - /** - * @var string - */ private $propertyPath; - - /** - * @var mixed - */ private $invalidValue; - - /** - * @var Constraint|null - */ private $constraint; - - /** - * @var mixed - */ private $code; - - /** - * @var mixed - */ private $cause; /** diff --git a/src/Symfony/Component/Validator/ConstraintViolationListInterface.php b/src/Symfony/Component/Validator/ConstraintViolationListInterface.php index bc7dc9ee46247..0489ab500a1dc 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationListInterface.php +++ b/src/Symfony/Component/Validator/ConstraintViolationListInterface.php @@ -20,15 +20,11 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar { /** * Adds a constraint violation to this list. - * - * @param ConstraintViolationInterface $violation The violation to add */ public function add(ConstraintViolationInterface $violation); /** * Merges an existing violation list into this list. - * - * @param ConstraintViolationListInterface $otherList The list to merge */ public function addAll(ConstraintViolationListInterface $otherList); diff --git a/src/Symfony/Component/Validator/Constraints/IbanValidator.php b/src/Symfony/Component/Validator/Constraints/IbanValidator.php index e31ea61a85c96..28ac23143a1b4 100644 --- a/src/Symfony/Component/Validator/Constraints/IbanValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IbanValidator.php @@ -34,8 +34,6 @@ class IbanValidator extends ConstraintValidator * included within it, a bank identifier with a fixed position and a fixed length per country * * @see https://www.swift.com/sites/default/files/resources/iban_registry.pdf - * - * @var array */ private static $formats = array( 'AD' => 'AD\d{2}\d{4}\d{4}[\dA-Z]{12}', // Andorra diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index f987698fb83db..ee0a9cd9d12c8 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -23,7 +23,7 @@ class UrlValidator extends ConstraintValidator { const PATTERN = '~^ (%s):// # protocol - (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth + (([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth ( ([\pL\pN\pS-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name | # or diff --git a/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php b/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php index e8047c60ca8bc..f770f46154077 100644 --- a/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php +++ b/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php @@ -38,8 +38,6 @@ public function read($class); /** * Stores a class metadata in the cache. - * - * @param ClassMetadata $metadata A Class Metadata */ public function write(ClassMetadata $metadata); } diff --git a/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php b/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php index 6dd5447fedc88..36f1febc5ac67 100644 --- a/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php +++ b/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php @@ -23,21 +23,11 @@ final class DoctrineCache implements CacheInterface { private $cache; - /** - * Creates a new Doctrine cache. - * - * @param Cache $cache The cache to adapt - */ public function __construct(Cache $cache) { $this->cache = $cache; } - /** - * Sets the cache to adapt. - * - * @param Cache $cache The cache to adapt - */ public function setCache(Cache $cache) { $this->cache = $cache; diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php index 3381076f3e48c..39fb926ef684c 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php @@ -334,8 +334,6 @@ public function addGetterMethodConstraints($property, $method, array $constraint /** * Merges the constraints of the given metadata into this object. - * - * @param ClassMetadata $source The source metadata */ public function mergeConstraints(ClassMetadata $source) { @@ -502,11 +500,6 @@ public function getCascadingStrategy() return CascadingStrategy::NONE; } - /** - * Adds a property metadata. - * - * @param PropertyMetadataInterface $metadata - */ private function addPropertyMetadata(PropertyMetadataInterface $metadata) { $property = $metadata->getPropertyName(); diff --git a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php index a14b6578e359c..83099aa5e3762 100644 --- a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php @@ -114,8 +114,6 @@ public function __clone() * - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled * - {@link TraversalStrategy::NONE} if $traverse is disabled * - * @param Constraint $constraint The constraint to add - * * @return $this * * @throws ConstraintDefinitionException When trying to add the diff --git a/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php index 0d61e9aa4394a..9d92de348ae5c 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php @@ -32,9 +32,6 @@ abstract class AbstractLoader implements LoaderInterface */ const DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'; - /** - * @var array - */ protected $namespaces = array(); /** diff --git a/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php b/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php index 5dadc82eb8094..d988309f811df 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php @@ -23,8 +23,6 @@ interface LoaderInterface /** * Loads validation metadata into a {@link ClassMetadata} instance. * - * @param ClassMetadata $metadata The metadata to load - * * @return bool Whether the loader succeeded */ public function loadClassMetadata(ClassMetadata $metadata); diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf index d631797018bb8..668b2a631e9f3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf @@ -140,7 +140,7 @@ This value is not a valid language. - Dëse Wäert aentsprécht kenger gëlteger Sprooch. + Dëse Wäert entsprécht kenger gëlteger Sprooch. This value is not a valid locale. @@ -180,7 +180,7 @@ This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. - Dëse Wäert sollt exactly {{ limit }} Buschtaf hunn.|Dëse Wäert sollt exakt {{ limit }} Buschtawen hunn. + Dëse Wäert sollt exakt {{ limit }} Buschtaf hunn.|Dëse Wäert sollt exakt {{ limit }} Buschtawen hunn. The file was only partially uploaded. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Et gouf keen temporären Dossier an der php.ini konfiguréiert. + Et gouf keen temporären Dossier an der php.ini konfiguréiert oder den temporären Dossier existéiert net. Cannot write temporary file to disk. @@ -304,7 +304,7 @@ The host could not be resolved. - Den Domain-Numm konnt net opgeléist ginn. + Den Host-Numm konnt net opgeléist ginn. This value does not match the expected {{ charset }} charset. diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php index 112404907b0e8..2424e49ad454d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -116,6 +116,9 @@ public function getValidUrls() array('http://xn--d1abbgf6aiiy.xn--p1ai/'), array('http://☎.com/'), array('http://username:password@symfony.com'), + array('http://user.name:password@symfony.com'), + array('http://username:pass.word@symfony.com'), + array('http://user.name:pass.word@symfony.com'), array('http://user-name@symfony.com'), array('http://symfony.com?'), array('http://symfony.com?query=1'), diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php index 90b384a3111bd..0480a5463283f 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php @@ -38,9 +38,6 @@ abstract class AbstractTest extends AbstractValidatorTest protected $validator; /** - * @param MetadataFactoryInterface $metadataFactory - * @param array $objectInitializers - * * @return ValidatorInterface */ abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()); diff --git a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php index e9576f5eceb37..5bac2e88987f6 100644 --- a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php @@ -91,8 +91,6 @@ public function startContext(); * The returned validator adds all generated violations to the given * context. * - * @param ExecutionContextInterface $context The execution context - * * @return ContextualValidatorInterface The validator for that context */ public function inContext(ExecutionContextInterface $context); diff --git a/src/Symfony/Component/Validator/ValidatorBuilderInterface.php b/src/Symfony/Component/Validator/ValidatorBuilderInterface.php index e4bd1040133d5..d7cd16836bf35 100644 --- a/src/Symfony/Component/Validator/ValidatorBuilderInterface.php +++ b/src/Symfony/Component/Validator/ValidatorBuilderInterface.php @@ -27,8 +27,6 @@ interface ValidatorBuilderInterface /** * Adds an object initializer to the validator. * - * @param ObjectInitializerInterface $initializer The initializer - * * @return $this */ public function addObjectInitializer(ObjectInitializerInterface $initializer); @@ -36,7 +34,7 @@ public function addObjectInitializer(ObjectInitializerInterface $initializer); /** * Adds a list of object initializers to the validator. * - * @param array $initializers The initializer + * @param ObjectInitializerInterface[] $initializers * * @return $this */ @@ -54,7 +52,7 @@ public function addXmlMapping($path); /** * Adds a list of XML constraint mapping files to the validator. * - * @param array $paths The paths to the mapping files + * @param string[] $paths The paths to the mapping files * * @return $this */ @@ -72,7 +70,7 @@ public function addYamlMapping($path); /** * Adds a list of YAML constraint mappings file to the validator. * - * @param array $paths The paths to the mapping files + * @param string[] $paths The paths to the mapping files * * @return $this */ @@ -90,7 +88,7 @@ public function addMethodMapping($methodName); /** * Enables constraint mapping using the given static methods. * - * @param array $methodNames The names of the methods + * @param string[] $methodNames The names of the methods * * @return $this */ @@ -99,8 +97,6 @@ public function addMethodMappings(array $methodNames); /** * Enables annotation based constraint mapping. * - * @param Reader $annotationReader The annotation reader to be used - * * @return $this */ public function enableAnnotationMapping(Reader $annotationReader = null); @@ -115,8 +111,6 @@ public function disableAnnotationMapping(); /** * Sets the class metadata factory used by the validator. * - * @param MetadataFactoryInterface $metadataFactory The metadata factory - * * @return $this */ public function setMetadataFactory(MetadataFactoryInterface $metadataFactory); @@ -124,8 +118,6 @@ public function setMetadataFactory(MetadataFactoryInterface $metadataFactory); /** * Sets the cache for caching class metadata. * - * @param CacheInterface $cache The cache instance - * * @return $this */ public function setMetadataCache(CacheInterface $cache); @@ -133,8 +125,6 @@ public function setMetadataCache(CacheInterface $cache); /** * Sets the constraint validator factory used by the validator. * - * @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory - * * @return $this */ public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory); @@ -142,8 +132,6 @@ public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterfac /** * Sets the translator used for translating violation messages. * - * @param TranslatorInterface $translator The translator instance - * * @return $this */ public function setTranslator(TranslatorInterface $translator); diff --git a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php b/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php index 2c3d9db850d08..b173bccf38916 100644 --- a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php +++ b/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php @@ -20,10 +20,5 @@ */ interface DataDumperInterface { - /** - * Dumps a Data object. - * - * @param Data $data A Data object - */ public function dump(Data $data); } diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index e554d4ae5fe1d..37c1a1a468b1c 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -383,8 +383,9 @@ function xpathString(str) { x += elt.parentNode.getAttribute('data-depth')/1; } elt.setAttribute('data-depth', x); - if (elt.className ? 'sf-dump-expanded' !== elt.className : (x > options.maxDepth)) { - elt.className = 'sf-dump-expanded'; + var className = elt.className; + elt.className = 'sf-dump-expanded'; + if (className ? 'sf-dump-expanded' !== className : (x > options.maxDepth)) { toggle(a); } } else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) { diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php index a5450edf33751..f6d03792b12a7 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php @@ -176,10 +176,10 @@ public function provideIntervals() return array( array('PT0S', 0, 0, '0s', '0s'), array('PT0S', 0.1, 0, '+ 00:00:00.100', '%is'), - array('PT1S', 0, 0, '+ 00:00:01.0', '1s'), - array('PT2M', 0, 0, '+ 00:02:00.0', '120s'), - array('PT3H', 0, 0, '+ 03:00:00.0', '10 800s'), - array('P4D', 0, 0, '+ 4d', '345 600s'), + array('PT1S', 0, 0, '+ 00:00:01.0', '%is'), + array('PT2M', 0, 0, '+ 00:02:00.0', '%is'), + array('PT3H', 0, 0, '+ 03:00:00.0', '%ss'), + array('P4D', 0, 0, '+ 4d', '%ss'), array('P5M', 0, 0, '+ 5m', null), array('P6Y', 0, 0, '+ 6y', null), array('P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06.0', null), @@ -190,10 +190,10 @@ public function provideIntervals() array('PT0S', 0, 1, '0s', '0s'), array('PT0S', 0.1, 1, '- 00:00:00.100', '%is'), - array('PT1S', 0, 1, '- 00:00:01.0', '-1s'), - array('PT2M', 0, 1, '- 00:02:00.0', '-120s'), - array('PT3H', 0, 1, '- 03:00:00.0', '-10 800s'), - array('P4D', 0, 1, '- 4d', '-345 600s'), + array('PT1S', 0, 1, '- 00:00:01.0', '%is'), + array('PT2M', 0, 1, '- 00:02:00.0', '%is'), + array('PT3H', 0, 1, '- 03:00:00.0', '%ss'), + array('P4D', 0, 1, '- 4d', '%ss'), array('P5M', 0, 1, '- 5m', null), array('P6Y', 0, 1, '- 6y', null), array('P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06.0', null), @@ -233,7 +233,7 @@ public function testDumpTimeZoneExcludingVerbosity($timezone, $expected) } EODUMP; - $this->assertDumpEquals($xDump, $timezone, Caster::EXCLUDE_VERBOSE); + $this->assertDumpMatchesFormat($xDump, $timezone, Caster::EXCLUDE_VERBOSE); } /** @@ -252,7 +252,7 @@ public function testCastTimeZone($timezone, $xTimezone, $xRegion) ] EODUMP; - $this->assertDumpEquals($xDump, $cast); + $this->assertDumpMatchesFormat($xDump, $cast); $xDump = <<