Merge branch '2.6' into 2.7

* 2.6:
  use Table instead of the deprecated TableHelper
  [2.3] fix failing test
  fixed typo
  Escape annotations in comments, refs #13089.
  [2.3] missing cleanup for legacy test
  add missing param names to @param annotation
  Improve the composer root version setting on Travis
  use Table instead of the deprecated TableHelper

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/composer.json
This commit is contained in:
Fabien Potencier 2015-01-05 22:00:14 +01:00
commit 72d0f93d79
9 changed files with 57 additions and 60 deletions

View File

@ -2,15 +2,15 @@ language: php
matrix: matrix:
include: include:
- php: 5.3.3
env: components=low
- php: 5.6
env: components=high
- php: 5.3.3 - php: 5.3.3
- php: 5.3 - php: 5.3
- php: 5.4 - php: 5.4
- php: 5.5 - php: 5.5
- php: 5.6 - php: 5.6
- php: 5.3.3
env: components=low
- php: 5.6
env: components=high
- php: hhvm-nightly - php: hhvm-nightly
allow_failures: allow_failures:
- php: hhvm-nightly - php: hhvm-nightly
@ -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 echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then php -i; fi; - if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then php -i; fi;
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale - 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: 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: 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 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" = "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" = "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_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" = "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;

View File

@ -1,6 +1,13 @@
UPGRADE FROM 2.4 to 2.5 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 Routing
------- -------

View File

@ -12,7 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
use Symfony\Component\Console\Descriptor\DescriptorInterface; 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\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -78,6 +78,16 @@ abstract class Descriptor implements DescriptorInterface
} }
} }
/**
* Returns the output.
*
* @return OutputInterface The output
*/
protected function getOutput()
{
return $this->output;
}
/** /**
* Writes content to output. * Writes content to output.
* *
@ -92,17 +102,18 @@ abstract class Descriptor implements DescriptorInterface
/** /**
* Writes content to output. * Writes content to output.
* *
* @param TableHelper $table * @param Table $table
* @param bool $decorated * @param bool $decorated
*/ */
protected function renderTable(TableHelper $table, $decorated = false) protected function renderTable(Table $table, $decorated = false)
{ {
if (!$decorated) { if (!$decorated) {
$table->setCellRowFormat('%s'); $table->getStyle()->setCellRowFormat('%s');
$table->setCellHeaderFormat('%s'); $table->getStyle()->setCellRowContentFormat('%s');
$table->getStyle()->setCellHeaderFormat('%s');
} }
$table->render($this->output); $table->render();
} }
/** /**

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; 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\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Definition;
@ -32,8 +32,8 @@ class TextDescriptor extends Descriptor
{ {
$showControllers = isset($options['show_controllers']) && $options['show_controllers']; $showControllers = isset($options['show_controllers']) && $options['show_controllers'];
$headers = array('Name', 'Method', 'Scheme', 'Host', 'Path'); $headers = array('Name', 'Method', 'Scheme', 'Host', 'Path');
$table = new TableHelper(); $table = new Table($this->getOutput());
$table->setLayout(TableHelper::LAYOUT_COMPACT); $table->setStyle('compact');
$table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers); $table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers);
foreach ($routes->all() as $name => $route) { foreach ($routes->all() as $name => $route) {
@ -100,8 +100,8 @@ class TextDescriptor extends Descriptor
*/ */
protected function describeContainerParameters(ParameterBag $parameters, array $options = array()) protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
{ {
$table = new TableHelper(); $table = new Table($this->getOutput());
$table->setLayout(TableHelper::LAYOUT_COMPACT); $table->setStyle('compact');
$table->setHeaders(array('Parameter', 'Value')); $table->setHeaders(array('Parameter', 'Value'));
foreach ($this->sortParameters($parameters) as $parameter => $value) { foreach ($this->sortParameters($parameters) as $parameter => $value) {
@ -201,8 +201,8 @@ class TextDescriptor extends Descriptor
$tagsCount = count($maxTags); $tagsCount = count($maxTags);
$tagsNames = array_keys($maxTags); $tagsNames = array_keys($maxTags);
$table = new TableHelper(); $table = new Table($this->getOutput());
$table->setLayout(TableHelper::LAYOUT_COMPACT); $table->setStyle('compact');
$table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Class name'))); $table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Class name')));
foreach ($this->sortServiceIds($serviceIds) as $serviceId) { foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
@ -304,27 +304,29 @@ class TextDescriptor extends Descriptor
$registeredListeners = $eventDispatcher->getListeners($event); $registeredListeners = $eventDispatcher->getListeners($event);
if (null !== $event) { if (null !== $event) {
$this->writeText("\n"); $this->writeText("\n");
$table = new TableHelper(); $table = new Table($this->getOutput());
$table->getStyle()->setCellHeaderFormat('%s');
$table->setHeaders(array('Order', 'Callable')); $table->setHeaders(array('Order', 'Callable'));
foreach ($registeredListeners as $order => $listener) { foreach ($registeredListeners as $order => $listener) {
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener))); $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener)));
} }
$this->renderTable($table); $this->renderTable($table, true);
} else { } else {
ksort($registeredListeners); ksort($registeredListeners);
foreach ($registeredListeners as $eventListened => $eventListeners) { foreach ($registeredListeners as $eventListened => $eventListeners) {
$this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options); $this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options);
$table = new TableHelper(); $table = new Table($this->getOutput());
$table->getStyle()->setCellHeaderFormat('%s');
$table->setHeaders(array('Order', 'Callable')); $table->setHeaders(array('Order', 'Callable'));
foreach ($eventListeners as $order => $eventListener) { foreach ($eventListeners as $order => $eventListener) {
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener))); $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener)));
} }
$this->renderTable($table); $this->renderTable($table, true);
} }
} }
} }

View File

@ -33,7 +33,7 @@
}, },
"require-dev": { "require-dev": {
"symfony/browser-kit": "~2.4|~3.0.0", "symfony/browser-kit": "~2.4|~3.0.0",
"symfony/console": "~2.4,>=2.4.8|~3.0.0", "symfony/console": "~2.5|~3.0.0",
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
"symfony/finder": "~2.0,>=2.0.5|~3.0.0", "symfony/finder": "~2.0,>=2.0.5|~3.0.0",

View File

@ -251,35 +251,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. * @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle
*
* The resource name must follow the following pattern:
*
* @<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",
* this method will look for a file named:
*
* $dir/<BundleName>/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
*/ */
public function locateResource($name, $dir = null, $first = true) public function locateResource($name, $dir = null, $first = true)
{ {

View File

@ -103,15 +103,17 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
* *
* The resource name must follow the following pattern: * 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 * where BundleName is the name of the bundle
* and the remaining part is the relative path in 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: * this method will look for a file named:
* *
* $dir/BundleName/path/without/Resources * $dir/<BundleName>/path/without/Resources
*
* before looking in the bundle resource folder.
* *
* @param string $name A resource name to locate * @param string $name A resource name to locate
* @param string $dir A directory where to look for the resource first * @param string $dir A directory where to look for the resource first

View File

@ -187,7 +187,7 @@ class ProcessBuilder
* *
* To disable the timeout, set this value to null. * To disable the timeout, set this value to null.
* *
* @param float|null * @param float|null $timeout
* *
* @return ProcessBuilder * @return ProcessBuilder
* *

View File

@ -48,7 +48,7 @@ class ClassUtils
/** /**
* Gets the real class name of a class name that could be a proxy. * Gets the real class name of a class name that could be a proxy.
* *
* @param string|object * @param string|object $object
* *
* @return string * @return string
*/ */