From c5ad74d4ba123f08f3ef4055c7f7482368345dbc Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 13 Dec 2014 10:50:51 +0100 Subject: [PATCH 1/8] use Table instead of the deprecated TableHelper --- UPGRADE-2.5.md | 7 ++++++ .../Console/Descriptor/Descriptor.php | 25 +++++++++++++------ .../Console/Descriptor/TextDescriptor.php | 14 +++++------ .../Bundle/FrameworkBundle/composer.json | 2 +- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/UPGRADE-2.5.md b/UPGRADE-2.5.md index 14323cc883..a9431f85fa 100644 --- a/UPGRADE-2.5.md +++ b/UPGRADE-2.5.md @@ -1,6 +1,13 @@ UPGRADE FROM 2.4 to 2.5 ======================= +FrameworkBundle +--------------- + +* The `Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor::renderTable()` + method expects the table to be an instance of `Symfony\Component\Console\Helper\Table` + instead of `Symfony\Component\Console\Helper\TableHelper`. + Routing ------- diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 7aaea0b9c3..35087e476d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; use Symfony\Component\Console\Descriptor\DescriptorInterface; -use Symfony\Component\Console\Helper\TableHelper; +use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -71,6 +71,16 @@ abstract class Descriptor implements DescriptorInterface } } + /** + * Returns the output. + * + * @return OutputInterface The output + */ + protected function getOutput() + { + return $this->output; + } + /** * Writes content to output. * @@ -85,17 +95,18 @@ abstract class Descriptor implements DescriptorInterface /** * Writes content to output. * - * @param TableHelper $table - * @param bool $decorated + * @param Table $table + * @param bool $decorated */ - protected function renderTable(TableHelper $table, $decorated = false) + protected function renderTable(Table $table, $decorated = false) { if (!$decorated) { - $table->setCellRowFormat('%s'); - $table->setCellHeaderFormat('%s'); + $table->getStyle()->setCellRowFormat('%s'); + $table->getStyle()->setCellRowContentFormat('%s'); + $table->getStyle()->setCellHeaderFormat('%s'); } - $table->render($this->output); + $table->render(); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 67cb356bc3..3daa77f0ae 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; -use Symfony\Component\Console\Helper\TableHelper; +use Symfony\Component\Console\Helper\Table; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -31,8 +31,8 @@ class TextDescriptor extends Descriptor { $showControllers = isset($options['show_controllers']) && $options['show_controllers']; $headers = array('Name', 'Method', 'Scheme', 'Host', 'Path'); - $table = new TableHelper(); - $table->setLayout(TableHelper::LAYOUT_COMPACT); + $table = new Table($this->getOutput()); + $table->setStyle('compact'); $table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers); foreach ($routes->all() as $name => $route) { @@ -99,8 +99,8 @@ class TextDescriptor extends Descriptor */ protected function describeContainerParameters(ParameterBag $parameters, array $options = array()) { - $table = new TableHelper(); - $table->setLayout(TableHelper::LAYOUT_COMPACT); + $table = new Table($this->getOutput()); + $table->setStyle('compact'); $table->setHeaders(array('Parameter', 'Value')); foreach ($this->sortParameters($parameters) as $parameter => $value) { @@ -200,8 +200,8 @@ class TextDescriptor extends Descriptor $tagsCount = count($maxTags); $tagsNames = array_keys($maxTags); - $table = new TableHelper(); - $table->setLayout(TableHelper::LAYOUT_COMPACT); + $table = new Table($this->getOutput()); + $table->setStyle('compact'); $table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Scope', 'Class name'))); foreach ($this->sortServiceIds($serviceIds) as $serviceId) { diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index e6a3b644a8..ce8eccf59e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -33,7 +33,7 @@ }, "require-dev": { "symfony/browser-kit": "~2.4", - "symfony/console": "~2.4,>=2.4.8", + "symfony/console": "~2.5,>=2.5.2", "symfony/css-selector": "~2.0,>=2.0.5", "symfony/dom-crawler": "~2.0,>=2.0.5", "symfony/finder": "~2.0,>=2.0.5", From 01f7a3a9fc2728bb32b741f309f3098f43e60705 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 3 Jan 2015 12:15:23 +0100 Subject: [PATCH 2/8] Improve the composer root version setting on Travis The previous implementation was setting dev-master in all branches. This was working fine only because the dev-master branch alias was never updated in maintenance branches, and so dev-master was aliased as 2.3.x-dev in the 2.3 branch. --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb1f213fa6..f7ed380669 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,13 +32,14 @@ before_install: - if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then php -i; fi; - sudo locale-gen fr_FR.UTF-8 && sudo update-locale -# - if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi; + # Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built + - if [ "$TRAVIS_BRANCH" = "master ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; install: - - if [ "$components" = "no" ]; then COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; fi; + - if [ "$components" = "no" ]; then composer --prefer-source --dev install; fi; script: - if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; - if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi; - - if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; - - if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --dev update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; + - if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi; From 665825b038eb257dbedce74c1ef1040c2fa4fada Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 4 Jan 2015 15:17:53 +0100 Subject: [PATCH 3/8] add missing param names to @param annotation --- src/Symfony/Component/Process/ProcessBuilder.php | 2 +- src/Symfony/Component/Security/Core/Util/ClassUtils.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Process/ProcessBuilder.php b/src/Symfony/Component/Process/ProcessBuilder.php index 6f3ed8a931..402e17eb83 100644 --- a/src/Symfony/Component/Process/ProcessBuilder.php +++ b/src/Symfony/Component/Process/ProcessBuilder.php @@ -166,7 +166,7 @@ class ProcessBuilder * * To disable the timeout, set this value to null. * - * @param float|null + * @param float|null $timeout * * @return ProcessBuilder * diff --git a/src/Symfony/Component/Security/Core/Util/ClassUtils.php b/src/Symfony/Component/Security/Core/Util/ClassUtils.php index 6107c40fa6..6c8709668f 100644 --- a/src/Symfony/Component/Security/Core/Util/ClassUtils.php +++ b/src/Symfony/Component/Security/Core/Util/ClassUtils.php @@ -48,7 +48,7 @@ class ClassUtils /** * Gets the real class name of a class name that could be a proxy. * - * @param string|object + * @param string|object $object * * @return string */ From 7e929ab16238d7d0e52cfb6467bc5357fda8bce5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 4 Jan 2015 16:10:38 +0100 Subject: [PATCH 4/8] [2.3] missing cleanup for legacy test --- ...TokenParserTest.php => LegacyRenderTokenParserTest.php} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename src/Symfony/Bundle/TwigBundle/Tests/TokenParser/{RenderTokenParserTest.php => LegacyRenderTokenParserTest.php} (91%) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/RenderTokenParserTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php similarity index 91% rename from src/Symfony/Bundle/TwigBundle/Tests/TokenParser/RenderTokenParserTest.php rename to src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php index 55ebcd2566..3e415abf3e 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/RenderTokenParserTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php @@ -15,8 +15,13 @@ use Symfony\Bundle\TwigBundle\Tests\TestCase; use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser; use Symfony\Bundle\TwigBundle\Node\RenderNode; -class RenderTokenParserTest extends TestCase +class LegacyRenderTokenParserTest extends TestCase { + public function setUp() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + } + /** * @dataProvider getTestsForRender */ From 0cb17f3dd2b5e1a8e372621312214bf4f162cff6 Mon Sep 17 00:00:00 2001 From: cmfcmf Date: Sun, 4 Jan 2015 19:14:50 +0100 Subject: [PATCH 5/8] Escape annotations in comments, refs #13089. --- src/Symfony/Component/HttpKernel/Kernel.php | 30 ++----------------- .../Component/HttpKernel/KernelInterface.php | 8 +++-- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 04ea9ab56b..b7a8292644 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -242,35 +242,9 @@ abstract class Kernel implements KernelInterface, TerminableInterface } /** - * Returns the file path for a given resource. + * {@inheritDoc} * - * A Resource can be a file or a directory. - * - * The resource name must follow the following pattern: - * - * @/path/to/a/file.something - * - * where BundleName is the name of the bundle - * and the remaining part is the relative path in the bundle. - * - * If $dir is passed, and the first segment of the path is "Resources", - * this method will look for a file named: - * - * $dir//path/without/Resources - * - * before looking in the bundle resource folder. - * - * @param string $name A resource name to locate - * @param string $dir A directory where to look for the resource first - * @param bool $first Whether to return the first path or paths for all matching bundles - * - * @return string|array The absolute path of the resource or an array if $first is false - * - * @throws \InvalidArgumentException if the file cannot be found or the name is not valid - * @throws \RuntimeException if the name contains invalid/unsafe - * @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle - * - * @api + * @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle */ public function locateResource($name, $dir = null, $first = true) { diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index 006a0fe31a..44c6f5be47 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -101,15 +101,17 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * The resource name must follow the following pattern: * - * @BundleName/path/to/a/file.something + * "@BundleName/path/to/a/file.something" * * where BundleName is the name of the bundle * and the remaining part is the relative path in the bundle. * - * If $dir is passed, and the first segment of the path is Resources, + * If $dir is passed, and the first segment of the path is "Resources", * this method will look for a file named: * - * $dir/BundleName/path/without/Resources + * $dir//path/without/Resources + * + * before looking in the bundle resource folder. * * @param string $name A resource name to locate * @param string $dir A directory where to look for the resource first From f7d489ef61bfadbb242601e3469be5142f60d70c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 5 Jan 2015 15:38:29 +0100 Subject: [PATCH 6/8] fixed typo --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f7ed380669..ec9bf6da4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,15 @@ language: php matrix: include: - - php: 5.3.3 - env: components=low - - php: 5.6 - env: components=high - php: 5.3.3 - php: 5.3 - php: 5.4 - php: 5.5 - php: 5.6 + - php: 5.3.3 + env: components=low + - php: 5.6 + env: components=high - php: hhvm-nightly allow_failures: - php: hhvm-nightly @@ -33,7 +33,7 @@ before_install: - if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then php -i; fi; - sudo locale-gen fr_FR.UTF-8 && sudo update-locale # Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built - - if [ "$TRAVIS_BRANCH" = "master ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; + - if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; install: - if [ "$components" = "no" ]; then composer --prefer-source --dev install; fi; From 064799a146f1a31676b654bf7a43c6c998dc74cb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 5 Jan 2015 20:37:56 +0100 Subject: [PATCH 7/8] [2.3] fix failing test --- .../ChoiceList/UnloadedEntityChoiceListSingleIntIdTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleIntIdTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleIntIdTest.php index a876878415..3fdb978666 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleIntIdTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleIntIdTest.php @@ -20,4 +20,9 @@ class UnloadedEntityChoiceListSingleIntIdTest extends AbstractEntityChoiceListSi { $this->markTestSkipped('Non-existing values are not detected for unloaded choice lists.'); } + + public function testLegacyGetIndicesForValuesIgnoresNonExistingValues() + { + $this->markTestSkipped('Non-existing values are not detected for unloaded choice lists.'); + } } From 0bcb59414e80bf911ad962c49aca6114b7a54370 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 5 Jan 2015 21:07:55 +0100 Subject: [PATCH 8/8] use Table instead of the deprecated TableHelper --- .../Console/Descriptor/TextDescriptor.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 4a391b4333..f01cb5aec5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -304,27 +304,29 @@ class TextDescriptor extends Descriptor $registeredListeners = $eventDispatcher->getListeners($event); if (null !== $event) { $this->writeText("\n"); - $table = new TableHelper(); + $table = new Table($this->getOutput()); + $table->getStyle()->setCellHeaderFormat('%s'); $table->setHeaders(array('Order', 'Callable')); foreach ($registeredListeners as $order => $listener) { $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener))); } - $this->renderTable($table); + $this->renderTable($table, true); } else { ksort($registeredListeners); foreach ($registeredListeners as $eventListened => $eventListeners) { $this->writeText(sprintf("\n[Event] %s\n", $eventListened), $options); - $table = new TableHelper(); + $table = new Table($this->getOutput()); + $table->getStyle()->setCellHeaderFormat('%s'); $table->setHeaders(array('Order', 'Callable')); foreach ($eventListeners as $order => $eventListener) { $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener))); } - $this->renderTable($table); + $this->renderTable($table, true); } } }