Merge branch '3.4'

* 3.4:
  [FrameworkBundle] removed doctrine/cache as a dependency
  drop hard dependency on the Stopwatch component
  Fix the conditional definition of the SymfonyTestsListener
  [DI] Fix keys resolution in ResolveParameterPlaceHoldersPass
  [FrameworkBundle] Fix colliding service ids
  [FrameworkBundle] deprecated validator.mapping.cache.doctrine.apc
  remove now useless condition
  Lazy load security listeners
  [EventDispatcher] Remove dead code in WrappedListener
  [Process] Deprecate ProcessBuilder
  Fix non-dumped voters in security panel
  search case insensitive
  [VarDumper] Cyclic searching dumps
  [Yaml] Remove line number in deprecation notices
  [SecurityBundle] Made 2 service aliases private
  Automatically enable the routing annotation loader
  [FrameworkBundle] KernelTestCase: deprecate not using KERNEL_CLASS
This commit is contained in:
Fabien Potencier 2017-06-12 11:12:26 -07:00
commit f309c09ed8
34 changed files with 289 additions and 108 deletions

View File

@ -4,7 +4,7 @@ UPGRADE FROM 3.3 to 3.4
DependencyInjection
-------------------
* Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
* Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
Finder
------
@ -13,6 +13,38 @@ Finder
deprecated and will be removed in 4.0 as it used to fix a bug which existed
before version 5.5.23/5.6.7.
FrameworkBundle
---------------
* The `doctrine/cache` dependency has been removed; require it via `composer
require doctrine/cache` if you are using Doctrine cache in your project.
* The `validator.mapping.cache.doctrine.apc` service has been deprecated.
* The `symfony/stopwatch` dependency has been removed, require it via `composer
require symfony/stopwatch` in your `dev` environment.
* Using the `KERNEL_DIR` environment variable or the automatic guessing based
on the `phpunit.xml` / `phpunit.xml.dist` file location is deprecated since 3.4.
Set the `KERNEL_CLASS` environment variable to the fully-qualified class name
of your Kernel instead. Not setting the `KERNEL_CLASS` environment variable
will throw an exception on 4.0 unless you override the `KernelTestCase::createKernel()`
or `KernelTestCase::getKernelClass()` method.
* The `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()`
methods are deprecated since 3.4 and will be removed in 4.0.
Process
-------
* The `Symfony\Component\Process\ProcessBuilder` class has been deprecated,
use the `Symfony\Component\Process\Process` class directly instead.
SecurityBundle
--------------
* `FirewallContext::getListeners()` now returns `\Traversable|array`
Validator
---------

View File

@ -227,6 +227,8 @@ Form
FrameworkBundle
---------------
* The `validator.mapping.cache.doctrine.apc` service has been removed.
* The `cache:clear` command does not warmup the cache anymore. Warmup should
be done via the `cache:warmup` command.
@ -330,6 +332,15 @@ FrameworkBundle
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass` class
has been removed. Use the `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass`
class instead.
* Using the `KERNEL_DIR` environment variable and the automatic guessing based
on the `phpunit.xml` file location have been removed from the `KernelTestCase::getKernelClass()`
method implementation. Set the `KERNEL_CLASS` environment variable to the
fully-qualified class name of your Kernel or override the `KernelTestCase::createKernel()`
or `KernelTestCase::getKernelClass()` method instead.
* The methods `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()`
have been removed.
* The `Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory` class has been removed.
Use `Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead.
@ -411,6 +422,9 @@ Ldap
Process
-------
* The `Symfony\Component\Process\ProcessBuilder` class has been removed,
use the `Symfony\Component\Process\Process` class directly instead.
* The `ProcessUtils::escapeArgument()` method has been removed, use a command line array or give env vars to the `Process::start/run()` method instead.
* Environment variables are always inherited in sub-processes.

View File

@ -94,8 +94,7 @@
"symfony/phpunit-bridge": "~3.2",
"symfony/polyfill-apcu": "~1.1",
"symfony/security-acl": "~2.8|~3.0",
"phpdocumentor/reflection-docblock": "^3.0",
"sensio/framework-extra-bundle": "^3.0.2"
"phpdocumentor/reflection-docblock": "^3.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0",

View File

@ -18,53 +18,53 @@ use PHPUnit\Framework\Warning;
if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\SymfonyTestsListener');
return;
}
/**
* Collects and replays skipped tests.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*/
class SymfonyTestsListener extends BaseTestListener
{
private $trait;
public function __construct(array $mockedNamespaces = array())
// Using an early return instead of a else does not work when using the PHPUnit phar due to some weird PHP behavior (the class
// gets defined without executing the code before it and so the definition is not properly conditional)
} else {
/**
* Collects and replays skipped tests.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*/
class SymfonyTestsListener extends BaseTestListener
{
$this->trait = new Legacy\SymfonyTestsListenerTrait($mockedNamespaces);
}
private $trait;
public function globalListenerDisabled()
{
$this->trait->globalListenerDisabled();
}
public function __construct(array $mockedNamespaces = array())
{
$this->trait = new Legacy\SymfonyTestsListenerTrait($mockedNamespaces);
}
public function startTestSuite(TestSuite $suite)
{
return $this->trait->startTestSuite($suite);
}
public function globalListenerDisabled()
{
$this->trait->globalListenerDisabled();
}
public function addSkippedTest(Test $test, \Exception $e, $time)
{
return $this->trait->addSkippedTest($test, $e, $time);
}
public function startTestSuite(TestSuite $suite)
{
return $this->trait->startTestSuite($suite);
}
public function startTest(Test $test)
{
return $this->trait->startTest($test);
}
public function addSkippedTest(Test $test, \Exception $e, $time)
{
return $this->trait->addSkippedTest($test, $e, $time);
}
public function addWarning(Test $test, Warning $e, $time)
{
return $this->trait->addWarning($test, $e, $time);
}
public function startTest(Test $test)
{
return $this->trait->startTest($test);
}
public function endTest(Test $test, $time)
{
return $this->trait->endTest($test, $time);
public function addWarning(Test $test, Warning $e, $time)
{
return $this->trait->addWarning($test, $e, $time);
}
public function endTest(Test $test, $time)
{
return $this->trait->endTest($test, $time);
}
}
}

View File

@ -18,6 +18,18 @@ CHANGELOG
* Removed class parameters related to routing
* Removed absolute template paths support in the template name parser
3.4.0
-----
* Removed `doctrine/cache` from the list of required dependencies in `composer.json`
* Deprecated `validator.mapping.cache.doctrine.apc` service
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
* The `symfony/stopwatch` dependency has been removed, require it via `composer
require symfony/stopwatch` in your `dev` environment.
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
3.3.0
-----
@ -65,7 +77,7 @@ CHANGELOG
`Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` instead
* Deprecated `ValidateWorkflowsPass`, use
`Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` instead
* Deprecated `ConstraintValidatorFactory`, use
* Deprecated `ConstraintValidatorFactory`, use
`Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead.
3.2.0

View File

@ -628,7 +628,18 @@ class Configuration implements ConfigurationInterface
->info('validation configuration')
->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
->children()
->scalarNode('cache')->end()
->scalarNode('cache')
->beforeNormalization()
// Can be removed in 4.0, when validator.mapping.cache.doctrine.apc is removed
->ifString()->then(function ($v) {
if ('validator.mapping.cache.doctrine.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) {
throw new LogicException('Doctrine APC cache for the validator cannot be enabled as the Doctrine Cache package is not installed.');
}
return $v;
})
->end()
->end()
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
->arrayNode('static_method')
->defaultValue(array('loadValidatorMetadata'))

View File

@ -15,6 +15,7 @@ use Doctrine\Common\Annotations\Reader;
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Config\FileLocator;
@ -46,6 +47,8 @@ use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
@ -56,6 +59,7 @@ 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\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\ObjectInitializerInterface;
use Symfony\Component\WebLink\HttpHeaderSerializer;
@ -571,9 +575,14 @@ class FrameworkExtension extends Extension
{
$loader->load('debug_prod.xml');
if (class_exists(Stopwatch::class)) {
$container->register('debug.stopwatch', Stopwatch::class);
$container->setAlias(Stopwatch::class, 'debug.stopwatch');
}
$debug = $container->getParameter('kernel.debug');
if ($debug) {
if ($debug && class_exists(Stopwatch::class)) {
$loader->load('debug.xml');
}
@ -620,6 +629,29 @@ class FrameworkExtension extends Extension
$container->setParameter('request_listener.http_port', $config['http_port']);
$container->setParameter('request_listener.https_port', $config['https_port']);
if ($this->annotationsConfigEnabled) {
$container->register('routing.loader.annotation', AnnotatedRouteControllerLoader::class)
->setPublic(false)
->addTag('routing.loader', array('priority' => -10))
->addArgument(new Reference('annotation_reader'));
$container->register('routing.loader.annotation.directory', AnnotationDirectoryLoader::class)
->setPublic(false)
->addTag('routing.loader', array('priority' => -10))
->setArguments(array(
new Reference('file_locator'),
new Reference('routing.loader.annotation'),
));
$container->register('routing.loader.annotation.file', AnnotationFileLoader::class)
->setPublic(false)
->addTag('routing.loader', array('priority' => -10))
->setArguments(array(
new Reference('file_locator'),
new Reference('routing.loader.annotation'),
));
}
}
/**
@ -753,7 +785,7 @@ class FrameworkExtension extends Extension
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
if ($container->getParameter('kernel.debug')) {
if ($container->getParameter('kernel.debug') && class_exists(Stopwatch::class)) {
$loader->load('templating_debug.xml');
$container->setDefinition('templating.engine.php', $container->findDefinition('debug.templating.engine.php'));
@ -1084,6 +1116,10 @@ class FrameworkExtension extends Extension
$loader->load('annotations.xml');
if ('none' !== $config['cache']) {
if (!class_exists('Doctrine\Common\Cache\CacheProvider')) {
throw new LogicException('Annotations cannot be enabled as the Doctrine Cache library is not installed.');
}
$cacheService = $config['cache'];
if ('php_array' === $config['cache']) {

View File

@ -23,9 +23,6 @@
<argument>true</argument>
</service>
<service id="debug.stopwatch" class="Symfony\Component\Stopwatch\Stopwatch" public="true" />
<service id="Symfony\Component\Stopwatch\Stopwatch" alias="debug.stopwatch" />
<service id="debug.file_link_formatter" class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter">
<argument>%debug.file_link_format%</argument>
</service>

View File

@ -57,6 +57,7 @@
</call>
</service>
</argument>
<deprecated>The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use a Psr6 cache like "validator.mapping.cache.symfony" instead.</deprecated>
</service>
<service id="validator.validator_factory" class="Symfony\Component\Validator\ContainerConstraintValidatorFactory">

View File

@ -0,0 +1,52 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Routing;
use Symfony\Component\Routing\Loader\AnnotationClassLoader;
use Symfony\Component\Routing\Route;
/**
* AnnotatedRouteControllerLoader is an implementation of AnnotationClassLoader
* that sets the '_controller' default based on the class and method names.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class AnnotatedRouteControllerLoader extends AnnotationClassLoader
{
/**
* Configures the _controller default parameter of a given Route instance.
*
* @param mixed $annot The annotation class instance
*/
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
{
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
}
/**
* Makes the default route name more sane by removing common keywords.
*
* @return string
*/
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
{
return preg_replace(array(
'/(bundle|controller)_/',
'/action(_\d+)?$/',
'/__/',
), array(
'_',
'\\1',
'_',
), parent::getDefaultRouteName($class, $method));
}
}

View File

@ -39,9 +39,13 @@ abstract class KernelTestCase extends TestCase
* @return string The directory where phpunit.xml(.dist) is stored
*
* @throws \RuntimeException
*
* @deprecated since 3.4 and will be removed in 4.0.
*/
protected static function getPhpUnitXmlDir()
{
@trigger_error(sprintf('The %s() method is deprecated since 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
if (!isset($_SERVER['argv']) || false === strpos($_SERVER['argv'][0], 'phpunit')) {
throw new \RuntimeException('You must override the KernelTestCase::createKernel() method.');
}
@ -72,9 +76,13 @@ abstract class KernelTestCase extends TestCase
* the last configuration argument.
*
* @return string The value of the PHPUnit CLI configuration option
*
* @deprecated since 3.4 and will be removed in 4.0.
*/
private static function getPhpUnitCliConfigArgument()
{
@trigger_error(sprintf('The %s() method is deprecated since 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
$dir = null;
$reversedArgs = array_reverse($_SERVER['argv']);
foreach ($reversedArgs as $argIndex => $testArg) {
@ -112,6 +120,8 @@ abstract class KernelTestCase extends TestCase
}
return $class;
} else {
@trigger_error(sprintf('Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the %1$::createKernel() or %1$::getKernelClass() method.', static::class), E_USER_DEPRECATED);
}
if (isset($_SERVER['KERNEL_DIR'])) {

View File

@ -11,10 +11,8 @@
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
return array(
new FrameworkBundle(),
new TestBundle(),
new SensioFrameworkExtraBundle(),
);

View File

@ -27,11 +27,10 @@
"symfony/polyfill-mbstring": "~1.0",
"symfony/filesystem": "~3.4|~4.0",
"symfony/finder": "~3.4|~4.0",
"symfony/routing": "~3.4|~4.0",
"symfony/stopwatch": "~3.4|~4.0",
"doctrine/cache": "~1.0"
"symfony/routing": "~3.4|~4.0"
},
"require-dev": {
"doctrine/cache": "~1.0",
"fig/link-util": "^1.0",
"symfony/asset": "~3.4|~4.0",
"symfony/browser-kit": "~3.4|~4.0",
@ -46,6 +45,7 @@
"symfony/security-core": "~3.4|~4.0",
"symfony/security-csrf": "~3.4|~4.0",
"symfony/serializer": "~3.4|~4.0",
"symfony/stopwatch": "~3.4|~4.0",
"symfony/translation": "~3.4|~4.0",
"symfony/templating": "~3.4|~4.0",
"symfony/validator": "~3.4|~4.0",
@ -56,8 +56,7 @@
"symfony/web-link": "~3.4|~4.0",
"doctrine/annotations": "~1.0",
"phpdocumentor/reflection-docblock": "^3.0",
"twig/twig": "~1.34|~2.4",
"sensio/framework-extra-bundle": "^3.0.2"
"twig/twig": "~1.34|~2.4"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0",

View File

@ -9,6 +9,11 @@ CHANGELOG
* made the first `UserPasswordEncoderCommand::_construct()` argument mandatory
* `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` anymore
3.4.0
-----
* [BC BREAK] `FirewallContext::getListeners()` now returns `\Traversable|array`
3.3.0
-----

View File

@ -243,7 +243,7 @@ class SecurityExtension extends Extension
$contextId = 'security.firewall.map.context.'.$name;
$context = $container->setDefinition($contextId, new ChildDefinition('security.firewall.context'));
$context
->replaceArgument(0, $listeners)
->replaceArgument(0, new IteratorArgument($listeners))
->replaceArgument(1, $exceptionListener)
->replaceArgument(2, new Reference($configId))
;

View File

@ -19,7 +19,7 @@
<argument type="service" id="security.access.decision_manager" />
<argument>%security.access.always_authenticate_before_granting%</argument>
</service>
<service id="Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface" alias="security.authorization_checker" public="true" />
<service id="Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface" alias="security.authorization_checker" />
<service id="security.token_storage" class="Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage" public="true" />
<service id="Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface" alias="security.token_storage" />
@ -59,7 +59,7 @@
</service>
<service id="security.password_encoder" alias="security.user_password_encoder.generic" public="true" />
<service id="Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface" alias="security.password_encoder" public="true" />
<service id="Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface" alias="security.password_encoder" />
<service id="security.user_checker" class="Symfony\Component\Security\Core\User\UserChecker" />

View File

@ -222,7 +222,7 @@
{% for voter in collector.voters %}
<tr>
<td class="font-normal text-small text-muted nowrap">{{ loop.index }}</td>
<td class="font-normal">{{ voter }}</td>
<td class="font-normal">{{ profiler_dump(voter) }}</td>
</tr>
{% endfor %}
</tbody>

View File

@ -25,7 +25,12 @@ class FirewallContext
private $exceptionListener;
private $config;
public function __construct(array $listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null)
/**
* @param \Traversable|array $listeners
* @param ExceptionListener|null $exceptionListener
* @param FirewallConfig|null $firewallConfig
*/
public function __construct($listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null)
{
$this->listeners = $listeners;
$this->exceptionListener = $exceptionListener;
@ -37,6 +42,9 @@ class FirewallContext
return $this->config;
}
/**
* @return \Traversable|array
*/
public function getListeners()
{
return $this->listeners;

View File

@ -72,7 +72,7 @@ abstract class CompleteConfigurationTest extends TestCase
foreach (array_keys($arguments[1]->getValues()) as $contextId) {
$contextDef = $container->getDefinition($contextId);
$arguments = $contextDef->getArguments();
$listeners[] = array_map('strval', $arguments['index_0']);
$listeners[] = array_map('strval', $arguments['index_0']->getValues());
$configDef = $container->getDefinition((string) $arguments['index_2']);
$configs[] = array_values($configDef->getArguments());

View File

@ -13,7 +13,6 @@ namespace Symfony\Bundle\WebServerBundle;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\Exception\RuntimeException;
/**
@ -151,11 +150,11 @@ class WebServer
throw new \RuntimeException('Unable to find the PHP binary.');
}
$builder = new ProcessBuilder(array($binary, '-S', $config->getAddress(), $config->getRouter()));
$builder->setWorkingDirectory($config->getDocumentRoot());
$builder->setTimeout(null);
$process = new Process(array($binary, '-S', $config->getAddress(), $config->getRouter()));
$process->setWorkingDirectory($config->getDocumentRoot());
$process->setTimeout(null);
return $builder->getProcess();
return $process;
}
private function getDefaultPidFile()

View File

@ -15,7 +15,6 @@ use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;
/**
* The ProcessHelper class provides helpers to run external processes.
@ -44,9 +43,7 @@ class ProcessHelper extends Helper
$formatter = $this->getHelperSet()->get('debug_formatter');
if (is_array($cmd)) {
$process = ProcessBuilder::create($cmd)->getProcess();
} elseif ($cmd instanceof Process) {
if ($cmd instanceof Process) {
$process = $cmd;
} else {
$process = new Process($cmd);

View File

@ -17,7 +17,6 @@ use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;
class ProcessHelperTest extends TestCase
{
@ -85,8 +84,8 @@ EOT;
EOT;
$errorMessage = 'An error occurred';
$args = new ProcessBuilder(array('php', '-r', 'echo 42;'));
$args = $args->getProcess()->getCommandLine();
$args = new Process(array('php', '-r', 'echo 42;'));
$args = $args->getCommandLine();
$successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug);
return array(

View File

@ -36,7 +36,8 @@
"psr/log": "For using the console logger"
},
"conflict": {
"symfony/dependency-injection": "<3.4"
"symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Console\\": "" },

View File

@ -65,10 +65,14 @@ class ResolveParameterPlaceHoldersPass extends AbstractRecursivePass
if (isset($changes['file'])) {
$value->setFile($this->bag->resolveValue($value->getFile()));
}
$value->setProperties($this->bag->resolveValue($value->getProperties()));
$value->setMethodCalls($this->bag->resolveValue($value->getMethodCalls()));
}
return parent::processValue($value, $isRoot);
$value = parent::processValue($value, $isRoot);
if ($value && is_array($value)) {
$value = array_combine($this->bag->resolveValue(array_keys($value)), $value);
}
return $value;
}
}

View File

@ -41,12 +41,12 @@ class ResolveParameterPlaceHoldersPassTest extends TestCase
public function testArgumentParametersShouldBeResolved()
{
$this->assertSame(array('bar', 'baz'), $this->fooDefinition->getArguments());
$this->assertSame(array('bar', array('bar' => 'baz')), $this->fooDefinition->getArguments());
}
public function testMethodCallParametersShouldBeResolved()
{
$this->assertSame(array(array('foobar', array('bar', 'baz'))), $this->fooDefinition->getMethodCalls());
$this->assertSame(array(array('foobar', array('bar', array('bar' => 'baz')))), $this->fooDefinition->getMethodCalls());
}
public function testPropertyParametersShouldBeResolved()
@ -71,7 +71,7 @@ class ResolveParameterPlaceHoldersPassTest extends TestCase
$containerBuilder->setParameter('foo.class', 'Foo');
$containerBuilder->setParameter('foo.factory.class', 'FooFactory');
$containerBuilder->setParameter('foo.arg1', 'bar');
$containerBuilder->setParameter('foo.arg2', 'baz');
$containerBuilder->setParameter('foo.arg2', array('%foo.arg1%' => 'baz'));
$containerBuilder->setParameter('foo.method', 'foobar');
$containerBuilder->setParameter('foo.property.name', 'bar');
$containerBuilder->setParameter('foo.property.value', 'baz');
@ -80,7 +80,7 @@ class ResolveParameterPlaceHoldersPassTest extends TestCase
$fooDefinition = $containerBuilder->register('foo', '%foo.class%');
$fooDefinition->setFactory(array('%foo.factory.class%', 'getFoo'));
$fooDefinition->setArguments(array('%foo.arg1%', '%foo.arg2%'));
$fooDefinition->setArguments(array('%foo.arg1%', array('%foo.arg1%' => 'baz')));
$fooDefinition->addMethodCall('%foo.method%', array('%foo.arg1%', '%foo.arg2%'));
$fooDefinition->setProperty('%foo.property.name%', '%foo.property.value%');
$fooDefinition->setFile('%foo.file%');

View File

@ -15,7 +15,6 @@ use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Cloner\VarCloner;
/**
* @author Fabien Potencier <fabien@symfony.com>
@ -30,8 +29,7 @@ class WrappedListener
private $dispatcher;
private $pretty;
private $stub;
private static $cloner;
private static $hasClassStub;
public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
{
@ -58,8 +56,8 @@ class WrappedListener
$this->name = $name;
}
if (null === self::$cloner) {
self::$cloner = class_exists(ClassStub::class) ? new VarCloner() : false;
if (null === self::$hasClassStub) {
self::$hasClassStub = class_exists(ClassStub::class);
}
}
@ -86,7 +84,7 @@ class WrappedListener
public function getInfo($eventName)
{
if (null === $this->stub) {
$this->stub = false === self::$cloner ? $this->pretty.'()' : new ClassStub($this->pretty.'()', $this->listener);
$this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()';
}
return array(

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
3.4.0
-----
* deprecated the ProcessBuilder class
3.3.0
-----

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Process;
@trigger_error(sprintf('The %s class is deprecated since version 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), E_USER_DEPRECATED);
use Symfony\Component\Process\Exception\InvalidArgumentException;
use Symfony\Component\Process\Exception\LogicException;
@ -18,6 +20,8 @@ use Symfony\Component\Process\Exception\LogicException;
* Process builder.
*
* @author Kris Wallsmith <kris@symfony.com>
*
* @deprecated since version 3.4, to be removed in 4.0. Use the Process class instead.
*/
class ProcessBuilder
{
@ -120,13 +124,9 @@ class ProcessBuilder
* @param bool $inheritEnv
*
* @return $this
*
* @deprecated since version 3.3, to be removed in 4.0.
*/
public function inheritEnvironmentVariables($inheritEnv = true)
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
$this->inheritEnv = $inheritEnv;
return $this;
@ -221,13 +221,9 @@ class ProcessBuilder
* @param string $value The option value
*
* @return $this
*
* @deprecated since version 3.3, to be removed in 4.0.
*/
public function setOption($name, $value)
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
$this->options[$name] = $value;
return $this;

View File

@ -14,11 +14,11 @@ namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\ProcessBuilder;
/**
* @group legacy
*/
class ProcessBuilderTest extends TestCase
{
/**
* @group legacy
*/
public function testInheritEnvironmentVars()
{
$proc = ProcessBuilder::create()

View File

@ -7,6 +7,11 @@ CHANGELOG
* dropped support for using UTF-8 route patterns without using the `utf8` option
* dropped support for using UTF-8 route requirements without using the `utf8` option
3.4.0
-----
* Added support for prioritized routing loaders.
3.3.0
-----
@ -25,7 +30,7 @@ CHANGELOG
* Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations.
* Added support for UTF-8 requirements
2.8.0
-----

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Routing\DependencyInjection;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
/**
* Adds tagged routing.loader services to routing.resolver service.
@ -22,6 +23,8 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
*/
class RoutingResolverPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;
private $resolverServiceId;
private $loaderTag;
@ -39,7 +42,7 @@ class RoutingResolverPass implements CompilerPassInterface
$definition = $container->getDefinition($this->resolverServiceId);
foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) {
foreach ($this->findAndSortTaggedServices($this->loaderTag, $container) as $id) {
$definition->addMethodCall('addLoader', array(new Reference($id)));
}
}

View File

@ -425,7 +425,7 @@ return function (root, x) {
if (this.isEmpty()) {
return this.current();
}
this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : this.idx;
this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0;
return this.current();
},
@ -433,7 +433,7 @@ return function (root, x) {
if (this.isEmpty()) {
return this.current();
}
this.idx = this.idx > 0 ? this.idx - 1 : this.idx;
this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1);
return this.current();
},
@ -507,7 +507,7 @@ return function (root, x) {
return;
}
var xpathResult = doc.evaluate('//pre[@id="' + root.id + '"]//span[@class="sf-dump-str" or @class="sf-dump-key" or @class="sf-dump-public" or @class="sf-dump-protected" or @class="sf-dump-private"][contains(child::text(), ' + xpathString(searchQuery) + ')]', document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
var xpathResult = doc.evaluate('//pre[@id="' + root.id + '"]//span[@class="sf-dump-str" or @class="sf-dump-key" or @class="sf-dump-public" or @class="sf-dump-protected" or @class="sf-dump-private"][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
while (node = xpathResult.iterateNext()) state.nodes.push(node);

View File

@ -440,7 +440,7 @@ class Inline
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags)) {
$evaluatedKey = self::evaluateScalar($key, $flags, $references);
if ('' !== $key && $evaluatedKey !== $key && !is_string($evaluatedKey)) {
if ('' !== $key && $evaluatedKey !== $key && !is_string($evaluatedKey) && !is_int($evaluatedKey)) {
throw new ParseException('Non-string mapping keys are not supported. Pass the Yaml::PARSE_KEYS_AS_STRINGS flag to cast them to strings.', self::$parsedLineNumber + 1, $mapping);
}
}

View File

@ -187,7 +187,7 @@ class Parser
throw $e;
}
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags) && !is_string($key)) {
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags) && !is_string($key) && !is_int($key)) {
throw new ParseException('Non-string mapping keys are not supported. Pass the Yaml::PARSE_KEYS_AS_STRINGS flag to cast them to strings.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
}