Merge branch '4.1'
* 4.1: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
This commit is contained in:
commit
e81285249b
11
.php_cs.dist
11
.php_cs.dist
@ -12,6 +12,10 @@ return PhpCsFixer\Config::create()
|
|||||||
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
|
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
|
||||||
'array_syntax' => array('syntax' => 'long'),
|
'array_syntax' => array('syntax' => 'long'),
|
||||||
'protected_to_private' => false,
|
'protected_to_private' => false,
|
||||||
|
// TODO remove the disabling once https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3876 is merged and released
|
||||||
|
'native_constant_invocation' => false,
|
||||||
|
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
|
||||||
|
'native_function_invocation' => array('include' => array('@compiler_optimized'), 'scope' => 'namespaced'),
|
||||||
))
|
))
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->setFinder(
|
->setFinder(
|
||||||
@ -26,12 +30,17 @@ return PhpCsFixer\Config::create()
|
|||||||
'Symfony/Component/Routing/Tests/Fixtures/dumper',
|
'Symfony/Component/Routing/Tests/Fixtures/dumper',
|
||||||
// fixture templates
|
// fixture templates
|
||||||
'Symfony/Component/Templating/Tests/Fixtures/templates',
|
'Symfony/Component/Templating/Tests/Fixtures/templates',
|
||||||
|
'Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TemplatePathsCache',
|
||||||
'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
|
'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
|
||||||
// generated fixtures
|
// generated fixtures
|
||||||
'Symfony/Component/VarDumper/Tests/Fixtures',
|
'Symfony/Component/VarDumper/Tests/Fixtures',
|
||||||
// resource templates
|
// resource templates
|
||||||
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
|
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
|
||||||
|
// explicit trigger_error tests
|
||||||
|
'Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/',
|
||||||
))
|
))
|
||||||
|
// Support for older PHPunit version
|
||||||
|
->notPath('Symfony/Bridge/PhpUnit/SymfonyTestsListener.php')
|
||||||
// file content autogenerated by `var_export`
|
// file content autogenerated by `var_export`
|
||||||
->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php')
|
->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php')
|
||||||
// test template
|
// test template
|
||||||
@ -39,8 +48,6 @@ return PhpCsFixer\Config::create()
|
|||||||
// explicit heredoc test
|
// explicit heredoc test
|
||||||
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
|
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
|
||||||
// explicit trigger_error tests
|
// explicit trigger_error tests
|
||||||
->notPath('Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt')
|
|
||||||
->notPath('Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt')
|
|
||||||
->notPath('Symfony/Component/Debug/Tests/DebugClassLoaderTest.php')
|
->notPath('Symfony/Component/Debug/Tests/DebugClassLoaderTest.php')
|
||||||
// invalid annotations on purpose
|
// invalid annotations on purpose
|
||||||
->notPath('Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php')
|
->notPath('Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php')
|
||||||
|
@ -54,7 +54,7 @@ class ContainerAwareEventManager extends EventManager
|
|||||||
$initialized = isset($this->initialized[$eventName]);
|
$initialized = isset($this->initialized[$eventName]);
|
||||||
|
|
||||||
foreach ($this->listeners[$eventName] as $hash => $listener) {
|
foreach ($this->listeners[$eventName] as $hash => $listener) {
|
||||||
if (!$initialized && is_string($listener)) {
|
if (!$initialized && \is_string($listener)) {
|
||||||
$this->listeners[$eventName][$hash] = $listener = $this->container->get($listener);
|
$this->listeners[$eventName][$hash] = $listener = $this->container->get($listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class ContainerAwareEventManager extends EventManager
|
|||||||
*/
|
*/
|
||||||
public function addEventListener($events, $listener)
|
public function addEventListener($events, $listener)
|
||||||
{
|
{
|
||||||
if (is_string($listener)) {
|
if (\is_string($listener)) {
|
||||||
if ($this->initialized) {
|
if ($this->initialized) {
|
||||||
throw new \RuntimeException('Adding lazy-loading listeners after construction is not supported.');
|
throw new \RuntimeException('Adding lazy-loading listeners after construction is not supported.');
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ class ContainerAwareEventManager extends EventManager
|
|||||||
*/
|
*/
|
||||||
public function removeEventListener($events, $listener)
|
public function removeEventListener($events, $listener)
|
||||||
{
|
{
|
||||||
if (is_string($listener)) {
|
if (\is_string($listener)) {
|
||||||
$hash = '_service_'.$listener;
|
$hash = '_service_'.$listener;
|
||||||
} else {
|
} else {
|
||||||
// Picks the hash code related to that listener
|
// Picks the hash code related to that listener
|
||||||
|
@ -134,14 +134,14 @@ class DoctrineDataCollector extends DataCollector
|
|||||||
if (null === $query['params']) {
|
if (null === $query['params']) {
|
||||||
$query['params'] = array();
|
$query['params'] = array();
|
||||||
}
|
}
|
||||||
if (!is_array($query['params'])) {
|
if (!\is_array($query['params'])) {
|
||||||
$query['params'] = array($query['params']);
|
$query['params'] = array($query['params']);
|
||||||
}
|
}
|
||||||
foreach ($query['params'] as $j => $param) {
|
foreach ($query['params'] as $j => $param) {
|
||||||
if (isset($query['types'][$j])) {
|
if (isset($query['types'][$j])) {
|
||||||
// Transform the param according to the type
|
// Transform the param according to the type
|
||||||
$type = $query['types'][$j];
|
$type = $query['types'][$j];
|
||||||
if (is_string($type)) {
|
if (\is_string($type)) {
|
||||||
$type = Type::getType($type);
|
$type = Type::getType($type);
|
||||||
}
|
}
|
||||||
if ($type instanceof Type) {
|
if ($type instanceof Type) {
|
||||||
@ -168,15 +168,15 @@ class DoctrineDataCollector extends DataCollector
|
|||||||
*/
|
*/
|
||||||
private function sanitizeParam($var): array
|
private function sanitizeParam($var): array
|
||||||
{
|
{
|
||||||
if (is_object($var)) {
|
if (\is_object($var)) {
|
||||||
$className = get_class($var);
|
$className = \get_class($var);
|
||||||
|
|
||||||
return method_exists($var, '__toString') ?
|
return method_exists($var, '__toString') ?
|
||||||
array(sprintf('/* Object(%s): */"%s"', $className, $var->__toString()), false) :
|
array(sprintf('/* Object(%s): */"%s"', $className, $var->__toString()), false) :
|
||||||
array(sprintf('/* Object(%s) */', $className), false);
|
array(sprintf('/* Object(%s) */', $className), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($var)) {
|
if (\is_array($var)) {
|
||||||
$a = array();
|
$a = array();
|
||||||
$original = true;
|
$original = true;
|
||||||
foreach ($var as $k => $v) {
|
foreach ($var as $k => $v) {
|
||||||
@ -188,7 +188,7 @@ class DoctrineDataCollector extends DataCollector
|
|||||||
return array($a, $original);
|
return array($a, $original);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_resource($var)) {
|
if (\is_resource($var)) {
|
||||||
return array(sprintf('/* Resource(%s) */', get_resource_type($var)), false);
|
return array(sprintf('/* Resource(%s) */', get_resource_type($var)), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
|||||||
*/
|
*/
|
||||||
protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container)
|
protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$bundleDir = dirname($bundle->getFileName());
|
$bundleDir = \dirname($bundle->getFileName());
|
||||||
|
|
||||||
if (!$bundleConfig['type']) {
|
if (!$bundleConfig['type']) {
|
||||||
$bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container);
|
$bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container);
|
||||||
@ -153,7 +153,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$bundleConfig['dir']) {
|
if (!$bundleConfig['dir']) {
|
||||||
if (in_array($bundleConfig['type'], array('annotation', 'staticphp'))) {
|
if (\in_array($bundleConfig['type'], array('annotation', 'staticphp'))) {
|
||||||
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingObjectDefaultName();
|
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingObjectDefaultName();
|
||||||
} else {
|
} else {
|
||||||
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingResourceConfigDirectory();
|
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingResourceConfigDirectory();
|
||||||
@ -240,7 +240,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
|||||||
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
|
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
|
if (!\in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
|
||||||
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
|
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
|
||||||
'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.
|
'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.
|
||||||
'You can register them by adding a new driver to the '.
|
'You can register them by adding a new driver to the '.
|
||||||
@ -272,7 +272,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
|||||||
// add the closest existing directory as a resource
|
// add the closest existing directory as a resource
|
||||||
$resource = $dir.'/'.$configPath;
|
$resource = $dir.'/'.$configPath;
|
||||||
while (!is_dir($resource)) {
|
while (!is_dir($resource)) {
|
||||||
$resource = dirname($resource);
|
$resource = \dirname($resource);
|
||||||
}
|
}
|
||||||
$container->fileExists($resource, false);
|
$container->fileExists($resource, false);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class DoctrineValidationPass implements CompilerPassInterface
|
|||||||
|
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
||||||
$reflection = new \ReflectionClass($bundle);
|
$reflection = new \ReflectionClass($bundle);
|
||||||
if ($container->fileExists($file = dirname($reflection->getFileName()).'/'.$validationPath)) {
|
if ($container->fileExists($file = \dirname($reflection->getFileName()).'/'.$validationPath)) {
|
||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
|||||||
|
|
||||||
if ($sortedTags) {
|
if ($sortedTags) {
|
||||||
krsort($sortedTags);
|
krsort($sortedTags);
|
||||||
$sortedTags = call_user_func_array('array_merge', $sortedTags);
|
$sortedTags = \call_user_func_array('array_merge', $sortedTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sortedTags;
|
return $sortedTags;
|
||||||
|
@ -124,7 +124,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
|
|||||||
$this->managerParameters = $managerParameters;
|
$this->managerParameters = $managerParameters;
|
||||||
$this->driverPattern = $driverPattern;
|
$this->driverPattern = $driverPattern;
|
||||||
$this->enabledParameter = $enabledParameter;
|
$this->enabledParameter = $enabledParameter;
|
||||||
if (count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) {
|
if (\count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) {
|
||||||
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias');
|
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias');
|
||||||
}
|
}
|
||||||
$this->configurationPattern = $configurationPattern;
|
$this->configurationPattern = $configurationPattern;
|
||||||
@ -149,7 +149,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
|
|||||||
$chainDriverDef->addMethodCall('addDriver', array($mappingDriverDef, $namespace));
|
$chainDriverDef->addMethodCall('addDriver', array($mappingDriverDef, $namespace));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count($this->aliasMap)) {
|
if (!\count($this->aliasMap)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
|
|||||||
|
|
||||||
// Optimize performance for single-field identifiers. We already
|
// Optimize performance for single-field identifiers. We already
|
||||||
// know that the IDs are used as values
|
// know that the IDs are used as values
|
||||||
$optimize = null === $value || is_array($value) && $value[0] === $this->idReader;
|
$optimize = null === $value || \is_array($value) && $value[0] === $this->idReader;
|
||||||
|
|
||||||
// Attention: This optimization does not check choices for existence
|
// Attention: This optimization does not check choices for existence
|
||||||
if ($optimize && !$this->choiceList && $this->idReader->isSingleId()) {
|
if ($optimize && !$this->choiceList && $this->idReader->isSingleId()) {
|
||||||
@ -120,7 +120,7 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
|
|||||||
|
|
||||||
// Optimize performance in case we have an object loader and
|
// Optimize performance in case we have an object loader and
|
||||||
// a single-field identifier
|
// a single-field identifier
|
||||||
$optimize = null === $value || is_array($value) && $this->idReader === $value[0];
|
$optimize = null === $value || \is_array($value) && $this->idReader === $value[0];
|
||||||
|
|
||||||
if ($optimize && !$this->choiceList && $this->objectLoader && $this->idReader->isSingleId()) {
|
if ($optimize && !$this->choiceList && $this->objectLoader && $this->idReader->isSingleId()) {
|
||||||
$unorderedObjects = $this->objectLoader->getEntitiesByIds($this->idReader->getIdField(), $values);
|
$unorderedObjects = $this->objectLoader->getEntitiesByIds($this->idReader->getIdField(), $values);
|
||||||
|
@ -42,8 +42,8 @@ class IdReader
|
|||||||
|
|
||||||
$this->om = $om;
|
$this->om = $om;
|
||||||
$this->classMetadata = $classMetadata;
|
$this->classMetadata = $classMetadata;
|
||||||
$this->singleId = 1 === count($ids);
|
$this->singleId = 1 === \count($ids);
|
||||||
$this->intId = $this->singleId && in_array($idType, array('integer', 'smallint', 'bigint'));
|
$this->intId = $this->singleId && \in_array($idType, array('integer', 'smallint', 'bigint'));
|
||||||
$this->idField = current($ids);
|
$this->idField = current($ids);
|
||||||
|
|
||||||
// single field association are resolved, since the schema column could be an int
|
// single field association are resolved, since the schema column could be an int
|
||||||
@ -95,7 +95,7 @@ class IdReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->om->contains($object)) {
|
if (!$this->om->contains($object)) {
|
||||||
throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', get_class($object)));
|
throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', \get_class($object)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->om->initializeObject($object);
|
$this->om->initializeObject($object);
|
||||||
|
@ -64,7 +64,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
|
|||||||
// Guess type
|
// Guess type
|
||||||
$entity = current($qb->getRootEntities());
|
$entity = current($qb->getRootEntities());
|
||||||
$metadata = $qb->getEntityManager()->getClassMetadata($entity);
|
$metadata = $qb->getEntityManager()->getClassMetadata($entity);
|
||||||
if (in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) {
|
if (\in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) {
|
||||||
$parameterType = Connection::PARAM_INT_ARRAY;
|
$parameterType = Connection::PARAM_INT_ARRAY;
|
||||||
|
|
||||||
// Filter out non-integer values (e.g. ""). If we don't, some
|
// Filter out non-integer values (e.g. ""). If we don't, some
|
||||||
@ -72,7 +72,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
|
|||||||
$values = array_values(array_filter($values, function ($v) {
|
$values = array_values(array_filter($values, function ($v) {
|
||||||
return (string) $v === (string) (int) $v || ctype_digit($v);
|
return (string) $v === (string) (int) $v || ctype_digit($v);
|
||||||
}));
|
}));
|
||||||
} elseif (in_array($metadata->getTypeOfField($identifier), array('uuid', 'guid'))) {
|
} elseif (\in_array($metadata->getTypeOfField($identifier), array('uuid', 'guid'))) {
|
||||||
$parameterType = Connection::PARAM_STR_ARRAY;
|
$parameterType = Connection::PARAM_STR_ARRAY;
|
||||||
|
|
||||||
// Like above, but we just filter out empty strings.
|
// Like above, but we just filter out empty strings.
|
||||||
|
@ -36,7 +36,7 @@ class CollectionToArrayTransformer implements DataTransformerInterface
|
|||||||
|
|
||||||
// For cases when the collection getter returns $collection->toArray()
|
// For cases when the collection getter returns $collection->toArray()
|
||||||
// in order to prevent modifications of the returned collection
|
// in order to prevent modifications of the returned collection
|
||||||
if (is_array($collection)) {
|
if (\is_array($collection)) {
|
||||||
return $collection;
|
return $collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
|||||||
return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE);
|
return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
|
if (\in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
|
||||||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
|||||||
{
|
{
|
||||||
$ret = $this->getMetadata($class);
|
$ret = $this->getMetadata($class);
|
||||||
if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
|
if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
|
||||||
if (in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
|
if (\in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
|
||||||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class MergeDoctrineCollectionListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
// If all items were removed, call clear which has a higher
|
// If all items were removed, call clear which has a higher
|
||||||
// performance on persistent collections
|
// performance on persistent collections
|
||||||
if ($collection instanceof Collection && 0 === count($data)) {
|
if ($collection instanceof Collection && 0 === \count($data)) {
|
||||||
$collection->clear();
|
$collection->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,8 +216,8 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
|||||||
// Invoke the query builder closure so that we can cache choice lists
|
// Invoke the query builder closure so that we can cache choice lists
|
||||||
// for equal query builders
|
// for equal query builders
|
||||||
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
|
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
|
||||||
if (is_callable($queryBuilder)) {
|
if (\is_callable($queryBuilder)) {
|
||||||
$queryBuilder = call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
|
$queryBuilder = \call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $queryBuilder;
|
return $queryBuilder;
|
||||||
|
@ -28,8 +28,8 @@ class EntityType extends DoctrineType
|
|||||||
// Invoke the query builder closure so that we can cache choice lists
|
// Invoke the query builder closure so that we can cache choice lists
|
||||||
// for equal query builders
|
// for equal query builders
|
||||||
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
|
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
|
||||||
if (is_callable($queryBuilder)) {
|
if (\is_callable($queryBuilder)) {
|
||||||
$queryBuilder = call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
|
$queryBuilder = \call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
|
||||||
|
|
||||||
if (null !== $queryBuilder && !$queryBuilder instanceof QueryBuilder) {
|
if (null !== $queryBuilder && !$queryBuilder instanceof QueryBuilder) {
|
||||||
throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');
|
throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');
|
||||||
|
@ -71,12 +71,12 @@ class DbalLogger implements SQLLogger
|
|||||||
{
|
{
|
||||||
foreach ($params as $index => $param) {
|
foreach ($params as $index => $param) {
|
||||||
// normalize recursively
|
// normalize recursively
|
||||||
if (is_array($param)) {
|
if (\is_array($param)) {
|
||||||
$params[$index] = $this->normalizeParams($param);
|
$params[$index] = $this->normalizeParams($param);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_string($params[$index])) {
|
if (!\is_string($params[$index])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class EntityUserProvider implements UserProviderInterface
|
|||||||
$user = $repository->findOneBy(array($this->property => $username));
|
$user = $repository->findOneBy(array($this->property => $username));
|
||||||
} else {
|
} else {
|
||||||
if (!$repository instanceof UserLoaderInterface) {
|
if (!$repository instanceof UserLoaderInterface) {
|
||||||
throw new \InvalidArgumentException(sprintf('You must either make the "%s" entity Doctrine Repository ("%s") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.', $this->classOrAlias, get_class($repository)));
|
throw new \InvalidArgumentException(sprintf('You must either make the "%s" entity Doctrine Repository ("%s") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.', $this->classOrAlias, \get_class($repository)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $repository->loadUserByUsername($username);
|
$user = $repository->loadUserByUsername($username);
|
||||||
@ -71,7 +71,7 @@ class EntityUserProvider implements UserProviderInterface
|
|||||||
{
|
{
|
||||||
$class = $this->getClass();
|
$class = $this->getClass();
|
||||||
if (!$user instanceof $class) {
|
if (!$user instanceof $class) {
|
||||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
|
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$repository = $this->getRepository();
|
$repository = $this->getRepository();
|
||||||
|
@ -34,7 +34,7 @@ class DoctrineTestHelper
|
|||||||
*/
|
*/
|
||||||
public static function createTestEntityManager(Configuration $config = null)
|
public static function createTestEntityManager(Configuration $config = null)
|
||||||
{
|
{
|
||||||
if (!extension_loaded('pdo_sqlite')) {
|
if (!\extension_loaded('pdo_sqlite')) {
|
||||||
TestCase::markTestSkipped('Extension pdo_sqlite is required.');
|
TestCase::markTestSkipped('Extension pdo_sqlite is required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
'SecondBundle' => 'My\SecondBundle',
|
'SecondBundle' => 'My\SecondBundle',
|
||||||
);
|
);
|
||||||
|
|
||||||
$reflection = new \ReflectionClass(get_class($this->extension));
|
$reflection = new \ReflectionClass(\get_class($this->extension));
|
||||||
$method = $reflection->getMethod('fixManagersAutoMappings');
|
$method = $reflection->getMethod('fixManagersAutoMappings');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
'SecondBundle' => 'My\SecondBundle',
|
'SecondBundle' => 'My\SecondBundle',
|
||||||
);
|
);
|
||||||
|
|
||||||
$reflection = new \ReflectionClass(get_class($this->extension));
|
$reflection = new \ReflectionClass(\get_class($this->extension));
|
||||||
$method = $reflection->getMethod('fixManagersAutoMappings');
|
$method = $reflection->getMethod('fixManagersAutoMappings');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
|||||||
$ids = range(1, 300);
|
$ids = range(1, 300);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$name = 65 + (int) chr($id % 57);
|
$name = 65 + (int) \chr($id % 57);
|
||||||
$this->em->persist(new SingleIntIdEntity($id, $name));
|
$this->em->persist(new SingleIntIdEntity($id, $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class DbalLoggerTest extends TestCase
|
|||||||
;
|
;
|
||||||
|
|
||||||
$testStringArray = array('é', 'á', 'ű', 'ő', 'ú', 'ö', 'ü', 'ó', 'í');
|
$testStringArray = array('é', 'á', 'ű', 'ő', 'ú', 'ö', 'ü', 'ó', 'í');
|
||||||
$testStringCount = count($testStringArray);
|
$testStringCount = \count($testStringArray);
|
||||||
|
|
||||||
$shortString = '';
|
$shortString = '';
|
||||||
$longString = '';
|
$longString = '';
|
||||||
|
@ -50,7 +50,7 @@ class DoctrineFooType extends Type
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$value instanceof Foo) {
|
if (!$value instanceof Foo) {
|
||||||
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', gettype($value)));
|
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $foo->bar;
|
return $foo->bar;
|
||||||
@ -64,7 +64,7 @@ class DoctrineFooType extends Type
|
|||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!is_string($value)) {
|
if (!\is_string($value)) {
|
||||||
throw ConversionException::conversionFailed($value, self::NAME);
|
throw ConversionException::conversionFailed($value, self::NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class EntityUserProviderTest extends TestCase
|
|||||||
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
|
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
|
||||||
|
|
||||||
$user2 = $em->getReference('Symfony\Bridge\Doctrine\Tests\Fixtures\User', array('id1' => 1, 'id2' => 1));
|
$user2 = $em->getReference('Symfony\Bridge\Doctrine\Tests\Fixtures\User', array('id1' => 1, 'id2' => 1));
|
||||||
$this->assertTrue($provider->supportsClass(get_class($user2)));
|
$this->assertTrue($provider->supportsClass(\get_class($user2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadUserByUserNameShouldLoadUserWhenProperInterfaceProvided()
|
public function testLoadUserByUserNameShouldLoadUserWhenProperInterfaceProvided()
|
||||||
|
@ -46,17 +46,17 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UniqueEntity');
|
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UniqueEntity');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($constraint->fields) && !is_string($constraint->fields)) {
|
if (!\is_array($constraint->fields) && !\is_string($constraint->fields)) {
|
||||||
throw new UnexpectedTypeException($constraint->fields, 'array');
|
throw new UnexpectedTypeException($constraint->fields, 'array');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $constraint->errorPath && !is_string($constraint->errorPath)) {
|
if (null !== $constraint->errorPath && !\is_string($constraint->errorPath)) {
|
||||||
throw new UnexpectedTypeException($constraint->errorPath, 'string or null');
|
throw new UnexpectedTypeException($constraint->errorPath, 'string or null');
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = (array) $constraint->fields;
|
$fields = (array) $constraint->fields;
|
||||||
|
|
||||||
if (0 === count($fields)) {
|
if (0 === \count($fields)) {
|
||||||
throw new ConstraintDefinitionException('At least one field has to be specified.');
|
throw new ConstraintDefinitionException('At least one field has to be specified.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +71,14 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em));
|
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$em = $this->registry->getManagerForClass(get_class($entity));
|
$em = $this->registry->getManagerForClass(\get_class($entity));
|
||||||
|
|
||||||
if (!$em) {
|
if (!$em) {
|
||||||
throw new ConstraintDefinitionException(sprintf('Unable to find the object manager associated with an entity of class "%s".', get_class($entity)));
|
throw new ConstraintDefinitionException(sprintf('Unable to find the object manager associated with an entity of class "%s".', \get_class($entity)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = $em->getClassMetadata(get_class($entity));
|
$class = $em->getClassMetadata(\get_class($entity));
|
||||||
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
|
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
|
||||||
|
|
||||||
$criteria = array();
|
$criteria = array();
|
||||||
@ -133,7 +133,7 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
throw new ConstraintDefinitionException(sprintf('The "%s" entity repository does not support the "%s" entity. The entity should be an instance of or extend "%s".', $constraint->entityClass, $class->getName(), $supportedClass));
|
throw new ConstraintDefinitionException(sprintf('The "%s" entity repository does not support the "%s" entity. The entity should be an instance of or extend "%s".', $constraint->entityClass, $class->getName(), $supportedClass));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$repository = $em->getRepository(get_class($entity));
|
$repository = $em->getRepository(\get_class($entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $repository->{$constraint->repositoryMethod}($criteria);
|
$result = $repository->{$constraint->repositoryMethod}($criteria);
|
||||||
@ -182,11 +182,11 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
|
|
||||||
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, $value)
|
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, $value)
|
||||||
{
|
{
|
||||||
if (!is_object($value) || $value instanceof \DateTimeInterface) {
|
if (!\is_object($value) || $value instanceof \DateTimeInterface) {
|
||||||
return $this->formatValue($value, self::PRETTY_DATE);
|
return $this->formatValue($value, self::PRETTY_DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($class->getName() !== $idClass = get_class($value)) {
|
if ($class->getName() !== $idClass = \get_class($value)) {
|
||||||
// non unique value might be a composite PK that consists of other entity objects
|
// non unique value might be a composite PK that consists of other entity objects
|
||||||
if ($em->getMetadataFactory()->hasMetadataFor($idClass)) {
|
if ($em->getMetadataFactory()->hasMetadataFor($idClass)) {
|
||||||
$identifiers = $em->getClassMetadata($idClass)->getIdentifierValues($value);
|
$identifiers = $em->getClassMetadata($idClass)->getIdentifierValues($value);
|
||||||
@ -204,10 +204,10 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
array_walk($identifiers, function (&$id, $field) {
|
array_walk($identifiers, function (&$id, $field) {
|
||||||
if (!is_object($id) || $id instanceof \DateTimeInterface) {
|
if (!\is_object($id) || $id instanceof \DateTimeInterface) {
|
||||||
$idAsString = $this->formatValue($id, self::PRETTY_DATE);
|
$idAsString = $this->formatValue($id, self::PRETTY_DATE);
|
||||||
} else {
|
} else {
|
||||||
$idAsString = sprintf('object("%s")', get_class($id));
|
$idAsString = sprintf('object("%s")', \get_class($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = sprintf('%s => %s', $field, $idAsString);
|
$id = sprintf('%s => %s', $field, $idAsString);
|
||||||
|
@ -30,7 +30,7 @@ class DoctrineInitializer implements ObjectInitializerInterface
|
|||||||
|
|
||||||
public function initialize($object)
|
public function initialize($object)
|
||||||
{
|
{
|
||||||
$manager = $this->registry->getManagerForClass(get_class($object));
|
$manager = $this->registry->getManagerForClass(\get_class($object));
|
||||||
if (null !== $manager) {
|
if (null !== $manager) {
|
||||||
$manager->initializeObject($object);
|
$manager->initializeObject($object);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class HttpCodeActivationStrategy extends ErrorLevelActivationStrategy
|
|||||||
}
|
}
|
||||||
|
|
||||||
$urlBlacklist = null;
|
$urlBlacklist = null;
|
||||||
if (count($exclusion['urls'])) {
|
if (\count($exclusion['urls'])) {
|
||||||
return !preg_match('{('.implode('|', $exclusion['urls']).')}i', $request->getPathInfo());
|
return !preg_match('{('.implode('|', $exclusion['urls']).')}i', $request->getPathInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class ServerLogHandler extends AbstractHandler
|
|||||||
{
|
{
|
||||||
if ($this->processors) {
|
if ($this->processors) {
|
||||||
foreach ($this->processors as $processor) {
|
foreach ($this->processors as $processor) {
|
||||||
$record = call_user_func($processor, $record);
|
$record = \call_user_func($processor, $record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class ClockMock
|
|||||||
|
|
||||||
public static function register($class)
|
public static function register($class)
|
||||||
{
|
{
|
||||||
$self = get_called_class();
|
$self = \get_called_class();
|
||||||
|
|
||||||
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
|
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
|
||||||
if (0 < strpos($class, '\\Tests\\')) {
|
if (0 < strpos($class, '\\Tests\\')) {
|
||||||
@ -81,7 +81,7 @@ class ClockMock
|
|||||||
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
|
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
|
||||||
}
|
}
|
||||||
foreach ($mockedNs as $ns) {
|
foreach ($mockedNs as $ns) {
|
||||||
if (function_exists($ns.'\time')) {
|
if (\function_exists($ns.'\time')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
eval(<<<EOPHP
|
eval(<<<EOPHP
|
||||||
|
@ -68,7 +68,7 @@ class DeprecationErrorHandler
|
|||||||
foreach (get_declared_classes() as $class) {
|
foreach (get_declared_classes() as $class) {
|
||||||
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
|
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||||
$r = new \ReflectionClass($class);
|
$r = new \ReflectionClass($class);
|
||||||
$v = dirname(dirname($r->getFileName()));
|
$v = \dirname(\dirname($r->getFileName()));
|
||||||
if (file_exists($v.'/composer/installed.json')) {
|
if (file_exists($v.'/composer/installed.json')) {
|
||||||
$vendors[] = $v;
|
$vendors[] = $v;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ class DeprecationErrorHandler
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
foreach ($vendors as $vendor) {
|
foreach ($vendors as $vendor) {
|
||||||
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
|
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ class DeprecationErrorHandler
|
|||||||
$group = 'other';
|
$group = 'other';
|
||||||
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
|
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
|
||||||
|
|
||||||
$i = count($trace);
|
$i = \count($trace);
|
||||||
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) {
|
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) {
|
||||||
// No-op
|
// No-op
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ class DeprecationErrorHandler
|
|||||||
// if the error has been triggered from vendor code.
|
// if the error has been triggered from vendor code.
|
||||||
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
|
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
|
||||||
} else {
|
} else {
|
||||||
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
|
$class = isset($trace[$i]['object']) ? \get_class($trace[$i]['object']) : $trace[$i]['class'];
|
||||||
$method = $trace[$i]['function'];
|
$method = $trace[$i]['function'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class DeprecationErrorHandler
|
|||||||
|| 0 === strpos($method, 'provideLegacy')
|
|| 0 === strpos($method, 'provideLegacy')
|
||||||
|| 0 === strpos($method, 'getLegacy')
|
|| 0 === strpos($method, 'getLegacy')
|
||||||
|| strpos($class, '\Legacy')
|
|| strpos($class, '\Legacy')
|
||||||
|| in_array('legacy', $Test::getGroups($class, $method), true)
|
|| \in_array('legacy', $Test::getGroups($class, $method), true)
|
||||||
) {
|
) {
|
||||||
$group = 'legacy';
|
$group = 'legacy';
|
||||||
} elseif ($isVendor) {
|
} elseif ($isVendor) {
|
||||||
@ -154,7 +154,7 @@ class DeprecationErrorHandler
|
|||||||
$e = new \Exception($msg);
|
$e = new \Exception($msg);
|
||||||
$r = new \ReflectionProperty($e, 'trace');
|
$r = new \ReflectionProperty($e, 'trace');
|
||||||
$r->setAccessible(true);
|
$r->setAccessible(true);
|
||||||
$r->setValue($e, array_slice($trace, 1, $i));
|
$r->setValue($e, \array_slice($trace, 1, $i));
|
||||||
|
|
||||||
echo "\n".ucfirst($group).' deprecation triggered by '.$class.'::'.$method.':';
|
echo "\n".ucfirst($group).' deprecation triggered by '.$class.'::'.$method.':';
|
||||||
echo "\n".$msg;
|
echo "\n".$msg;
|
||||||
@ -255,12 +255,12 @@ class DeprecationErrorHandler
|
|||||||
|
|
||||||
// reset deprecations array
|
// reset deprecations array
|
||||||
foreach ($deprecations as $group => $arrayOrInt) {
|
foreach ($deprecations as $group => $arrayOrInt) {
|
||||||
$deprecations[$group] = is_int($arrayOrInt) ? 0 : array();
|
$deprecations[$group] = \is_int($arrayOrInt) ? 0 : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
register_shutdown_function(function () use (&$deprecations, $isFailing, $displayDeprecations, $mode) {
|
register_shutdown_function(function () use (&$deprecations, $isFailing, $displayDeprecations, $mode) {
|
||||||
foreach ($deprecations as $group => $arrayOrInt) {
|
foreach ($deprecations as $group => $arrayOrInt) {
|
||||||
if (0 < (is_int($arrayOrInt) ? $arrayOrInt : count($arrayOrInt))) {
|
if (0 < (\is_int($arrayOrInt) ? $arrayOrInt : \count($arrayOrInt))) {
|
||||||
echo "Shutdown-time deprecations:\n";
|
echo "Shutdown-time deprecations:\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ class DeprecationErrorHandler
|
|||||||
*/
|
*/
|
||||||
private static function hasColorSupport()
|
private static function hasColorSupport()
|
||||||
{
|
{
|
||||||
if (!defined('STDOUT')) {
|
if (!\defined('STDOUT')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,18 +316,18 @@ class DeprecationErrorHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (\DIRECTORY_SEPARATOR === '\\') {
|
if (\DIRECTORY_SEPARATOR === '\\') {
|
||||||
return (function_exists('sapi_windows_vt100_support')
|
return (\function_exists('sapi_windows_vt100_support')
|
||||||
&& sapi_windows_vt100_support(STDOUT))
|
&& sapi_windows_vt100_support(STDOUT))
|
||||||
|| false !== getenv('ANSICON')
|
|| false !== getenv('ANSICON')
|
||||||
|| 'ON' === getenv('ConEmuANSI')
|
|| 'ON' === getenv('ConEmuANSI')
|
||||||
|| 'xterm' === getenv('TERM');
|
|| 'xterm' === getenv('TERM');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('stream_isatty')) {
|
if (\function_exists('stream_isatty')) {
|
||||||
return stream_isatty(STDOUT);
|
return stream_isatty(STDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('posix_isatty')) {
|
if (\function_exists('posix_isatty')) {
|
||||||
return posix_isatty(STDOUT);
|
return posix_isatty(STDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class DnsMock
|
|||||||
|
|
||||||
public static function register($class)
|
public static function register($class)
|
||||||
{
|
{
|
||||||
$self = get_called_class();
|
$self = \get_called_class();
|
||||||
|
|
||||||
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
|
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
|
||||||
if (0 < strpos($class, '\\Tests\\')) {
|
if (0 < strpos($class, '\\Tests\\')) {
|
||||||
@ -173,7 +173,7 @@ class DnsMock
|
|||||||
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
|
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
|
||||||
}
|
}
|
||||||
foreach ($mockedNs as $ns) {
|
foreach ($mockedNs as $ns) {
|
||||||
if (function_exists($ns.'\checkdnsrr')) {
|
if (\function_exists($ns.'\checkdnsrr')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
eval(<<<EOPHP
|
eval(<<<EOPHP
|
||||||
|
@ -58,7 +58,7 @@ class CoverageListenerTrait
|
|||||||
if (method_exists($test->getTestResultObject(), 'addWarning') && class_exists(Warning::class)) {
|
if (method_exists($test->getTestResultObject(), 'addWarning') && class_exists(Warning::class)) {
|
||||||
$test->getTestResultObject()->addWarning($test, new Warning($message), 0);
|
$test->getTestResultObject()->addWarning($test, new Warning($message), 0);
|
||||||
} else {
|
} else {
|
||||||
$this->warnings[] = sprintf("%s::%s\n%s", get_class($test), $test->getName(), $message);
|
$this->warnings[] = sprintf("%s::%s\n%s", \get_class($test), $test->getName(), $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ class CoverageListenerTrait
|
|||||||
|
|
||||||
$cache = $r->getValue();
|
$cache = $r->getValue();
|
||||||
$cache = array_replace_recursive($cache, array(
|
$cache = array_replace_recursive($cache, array(
|
||||||
get_class($test) => array(
|
\get_class($test) => array(
|
||||||
'covers' => array($sutFqcn),
|
'covers' => array($sutFqcn),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@ -90,7 +90,7 @@ class CoverageListenerTrait
|
|||||||
return $resolver($test);
|
return $resolver($test);
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = get_class($test);
|
$class = \get_class($test);
|
||||||
|
|
||||||
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
|
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
|
||||||
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
|
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
|
||||||
|
@ -53,7 +53,7 @@ class SymfonyTestsListenerTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($mockedNamespaces as $type => $namespaces) {
|
foreach ($mockedNamespaces as $type => $namespaces) {
|
||||||
if (!is_array($namespaces)) {
|
if (!\is_array($namespaces)) {
|
||||||
$namespaces = array($namespaces);
|
$namespaces = array($namespaces);
|
||||||
}
|
}
|
||||||
if ('time-sensitive' === $type) {
|
if ('time-sensitive' === $type) {
|
||||||
@ -98,10 +98,10 @@ class SymfonyTestsListenerTrait
|
|||||||
$this->testsWithWarnings = array();
|
$this->testsWithWarnings = array();
|
||||||
|
|
||||||
foreach ($suite->tests() as $test) {
|
foreach ($suite->tests() as $test) {
|
||||||
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
|
if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
|
if (null === $Test::getPreserveGlobalStateSettings(\get_class($test), $test->getName(false))) {
|
||||||
$test->setPreserveGlobalState(false);
|
$test->setPreserveGlobalState(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,10 +139,10 @@ class SymfonyTestsListenerTrait
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$groups = $Test::getGroups($test->getName());
|
$groups = $Test::getGroups($test->getName());
|
||||||
if (in_array('time-sensitive', $groups, true)) {
|
if (\in_array('time-sensitive', $groups, true)) {
|
||||||
ClockMock::register($test->getName());
|
ClockMock::register($test->getName());
|
||||||
}
|
}
|
||||||
if (in_array('dns-sensitive', $groups, true)) {
|
if (\in_array('dns-sensitive', $groups, true)) {
|
||||||
DnsMock::register($test->getName());
|
DnsMock::register($test->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ class SymfonyTestsListenerTrait
|
|||||||
} elseif (2 === $this->state) {
|
} elseif (2 === $this->state) {
|
||||||
$skipped = array();
|
$skipped = array();
|
||||||
foreach ($suite->tests() as $test) {
|
foreach ($suite->tests() as $test) {
|
||||||
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)
|
if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)
|
||||||
|| isset($this->wasSkipped[$suiteName]['*'])
|
|| isset($this->wasSkipped[$suiteName]['*'])
|
||||||
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
|
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
|
||||||
$skipped[] = $test;
|
$skipped[] = $test;
|
||||||
@ -164,8 +164,8 @@ class SymfonyTestsListenerTrait
|
|||||||
public function addSkippedTest($test, \Exception $e, $time)
|
public function addSkippedTest($test, \Exception $e, $time)
|
||||||
{
|
{
|
||||||
if (0 < $this->state) {
|
if (0 < $this->state) {
|
||||||
if ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase) {
|
if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase) {
|
||||||
$class = get_class($test);
|
$class = \get_class($test);
|
||||||
$method = $test->getName();
|
$method = $test->getName();
|
||||||
} else {
|
} else {
|
||||||
$class = $test->getName();
|
$class = $test->getName();
|
||||||
@ -178,7 +178,7 @@ class SymfonyTestsListenerTrait
|
|||||||
|
|
||||||
public function startTest($test)
|
public function startTest($test)
|
||||||
{
|
{
|
||||||
if (-2 < $this->state && ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
|
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
|
||||||
if (null !== $test->getTestResultObject()) {
|
if (null !== $test->getTestResultObject()) {
|
||||||
$this->reportUselessTests = $test->getTestResultObject()->isStrictAboutTestsThatDoNotTestAnything();
|
$this->reportUselessTests = $test->getTestResultObject()->isStrictAboutTestsThatDoNotTestAnything();
|
||||||
}
|
}
|
||||||
@ -196,25 +196,25 @@ class SymfonyTestsListenerTrait
|
|||||||
$Test = 'PHPUnit\Util\Test';
|
$Test = 'PHPUnit\Util\Test';
|
||||||
$AssertionFailedError = 'PHPUnit\Framework\AssertionFailedError';
|
$AssertionFailedError = 'PHPUnit\Framework\AssertionFailedError';
|
||||||
}
|
}
|
||||||
$groups = $Test::getGroups(get_class($test), $test->getName(false));
|
$groups = $Test::getGroups(\get_class($test), $test->getName(false));
|
||||||
|
|
||||||
if (!$this->runsInSeparateProcess) {
|
if (!$this->runsInSeparateProcess) {
|
||||||
if (in_array('time-sensitive', $groups, true)) {
|
if (\in_array('time-sensitive', $groups, true)) {
|
||||||
ClockMock::register(get_class($test));
|
ClockMock::register(\get_class($test));
|
||||||
ClockMock::withClockMock(true);
|
ClockMock::withClockMock(true);
|
||||||
}
|
}
|
||||||
if (in_array('dns-sensitive', $groups, true)) {
|
if (\in_array('dns-sensitive', $groups, true)) {
|
||||||
DnsMock::register(get_class($test));
|
DnsMock::register(\get_class($test));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$annotations = $Test::parseTestMethodAnnotations(get_class($test), $test->getName(false));
|
$annotations = $Test::parseTestMethodAnnotations(\get_class($test), $test->getName(false));
|
||||||
|
|
||||||
if (isset($annotations['class']['expectedDeprecation'])) {
|
if (isset($annotations['class']['expectedDeprecation'])) {
|
||||||
$test->getTestResultObject()->addError($test, new $AssertionFailedError('`@expectedDeprecation` annotations are not allowed at the class level.'), 0);
|
$test->getTestResultObject()->addError($test, new $AssertionFailedError('`@expectedDeprecation` annotations are not allowed at the class level.'), 0);
|
||||||
}
|
}
|
||||||
if (isset($annotations['method']['expectedDeprecation'])) {
|
if (isset($annotations['method']['expectedDeprecation'])) {
|
||||||
if (!in_array('legacy', $groups, true)) {
|
if (!\in_array('legacy', $groups, true)) {
|
||||||
$this->error = new $AssertionFailedError('Only tests with the `@group legacy` annotation can have `@expectedDeprecation`.');
|
$this->error = new $AssertionFailedError('Only tests with the `@group legacy` annotation can have `@expectedDeprecation`.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ class SymfonyTestsListenerTrait
|
|||||||
|
|
||||||
public function addWarning($test, $e, $time)
|
public function addWarning($test, $e, $time)
|
||||||
{
|
{
|
||||||
if ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase) {
|
if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase) {
|
||||||
$this->testsWithWarnings[$test->getName()] = true;
|
$this->testsWithWarnings[$test->getName()] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ class SymfonyTestsListenerTrait
|
|||||||
$BaseTestRunner = 'PHPUnit\Runner\BaseTestRunner';
|
$BaseTestRunner = 'PHPUnit\Runner\BaseTestRunner';
|
||||||
$Warning = 'PHPUnit\Framework\Warning';
|
$Warning = 'PHPUnit\Framework\Warning';
|
||||||
}
|
}
|
||||||
$className = get_class($test);
|
$className = \get_class($test);
|
||||||
$classGroups = $Test::getGroups($className);
|
$classGroups = $Test::getGroups($className);
|
||||||
$groups = $Test::getGroups($className, $test->getName(false));
|
$groups = $Test::getGroups($className, $test->getName(false));
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ class SymfonyTestsListenerTrait
|
|||||||
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
|
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
|
||||||
$error = serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false), 'triggering_file' => isset($deprecation[2]) ? $deprecation[2] : null));
|
$error = serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false), 'triggering_file' => isset($deprecation[2]) ? $deprecation[2] : null));
|
||||||
if ($deprecation[0]) {
|
if ($deprecation[0]) {
|
||||||
trigger_error($error, E_USER_DEPRECATED);
|
@trigger_error($error, E_USER_DEPRECATED);
|
||||||
} else {
|
} else {
|
||||||
@trigger_error($error, E_USER_DEPRECATED);
|
@trigger_error($error, E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
@ -274,13 +274,13 @@ class SymfonyTestsListenerTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->expectedDeprecations) {
|
if ($this->expectedDeprecations) {
|
||||||
if (!in_array($test->getStatus(), array($BaseTestRunner::STATUS_SKIPPED, $BaseTestRunner::STATUS_INCOMPLETE), true)) {
|
if (!\in_array($test->getStatus(), array($BaseTestRunner::STATUS_SKIPPED, $BaseTestRunner::STATUS_INCOMPLETE), true)) {
|
||||||
$test->addToAssertionCount(count($this->expectedDeprecations));
|
$test->addToAssertionCount(\count($this->expectedDeprecations));
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
if (!$errored && !in_array($test->getStatus(), array($BaseTestRunner::STATUS_SKIPPED, $BaseTestRunner::STATUS_INCOMPLETE, $BaseTestRunner::STATUS_FAILURE, $BaseTestRunner::STATUS_ERROR), true)) {
|
if (!$errored && !\in_array($test->getStatus(), array($BaseTestRunner::STATUS_SKIPPED, $BaseTestRunner::STATUS_INCOMPLETE, $BaseTestRunner::STATUS_FAILURE, $BaseTestRunner::STATUS_ERROR), true)) {
|
||||||
try {
|
try {
|
||||||
$prefix = "@expectedDeprecation:\n";
|
$prefix = "@expectedDeprecation:\n";
|
||||||
$test->assertStringMatchesFormat($prefix.'%A '.implode("\n%A ", $this->expectedDeprecations)."\n%A", $prefix.' '.implode("\n ", $this->gatheredDeprecations)."\n");
|
$test->assertStringMatchesFormat($prefix.'%A '.implode("\n%A ", $this->expectedDeprecations)."\n%A", $prefix.' '.implode("\n ", $this->gatheredDeprecations)."\n");
|
||||||
@ -294,11 +294,11 @@ class SymfonyTestsListenerTrait
|
|||||||
$this->expectedDeprecations = $this->gatheredDeprecations = array();
|
$this->expectedDeprecations = $this->gatheredDeprecations = array();
|
||||||
$this->previousErrorHandler = null;
|
$this->previousErrorHandler = null;
|
||||||
}
|
}
|
||||||
if (!$this->runsInSeparateProcess && -2 < $this->state && ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
|
if (!$this->runsInSeparateProcess && -2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
|
||||||
if (in_array('time-sensitive', $groups, true)) {
|
if (\in_array('time-sensitive', $groups, true)) {
|
||||||
ClockMock::withClockMock(false);
|
ClockMock::withClockMock(false);
|
||||||
}
|
}
|
||||||
if (in_array('dns-sensitive', $groups, true)) {
|
if (\in_array('dns-sensitive', $groups, true)) {
|
||||||
DnsMock::withMockedHosts(array());
|
DnsMock::withMockedHosts(array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ class SymfonyTestsListenerTrait
|
|||||||
// If the message is serialized we need to extract the message. This occurs when the error is triggered by
|
// 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().
|
// by the isolated test path in \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest().
|
||||||
$parsedMsg = @unserialize($msg);
|
$parsedMsg = @unserialize($msg);
|
||||||
if (is_array($parsedMsg)) {
|
if (\is_array($parsedMsg)) {
|
||||||
$msg = $parsedMsg['deprecation'];
|
$msg = $parsedMsg['deprecation'];
|
||||||
}
|
}
|
||||||
if (error_reporting()) {
|
if (error_reporting()) {
|
||||||
|
@ -103,7 +103,7 @@ EOF;
|
|||||||
return '0.0.1';
|
return '0.0.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
return defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion();
|
return \defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ class AppVariable
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user = $token->getUser();
|
$user = $token->getUser();
|
||||||
if (is_object($user)) {
|
if (\is_object($user)) {
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ class AppVariable
|
|||||||
return $session->getFlashBag()->all();
|
return $session->getFlashBag()->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($types)) {
|
if (\is_string($types)) {
|
||||||
return $session->getFlashBag()->get($types);
|
return $session->getFlashBag()->get($types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ EOF
|
|||||||
$firstNamespace = true;
|
$firstNamespace = true;
|
||||||
$prevHasSeparator = false;
|
$prevHasSeparator = false;
|
||||||
foreach ($this->getLoaderPaths() as $namespace => $paths) {
|
foreach ($this->getLoaderPaths() as $namespace => $paths) {
|
||||||
if (!$firstNamespace && !$prevHasSeparator && count($paths) > 1) {
|
if (!$firstNamespace && !$prevHasSeparator && \count($paths) > 1) {
|
||||||
$rows[] = array('', '');
|
$rows[] = array('', '');
|
||||||
}
|
}
|
||||||
$firstNamespace = false;
|
$firstNamespace = false;
|
||||||
@ -129,7 +129,7 @@ EOF
|
|||||||
$rows[] = array($namespace, $path.DIRECTORY_SEPARATOR);
|
$rows[] = array($namespace, $path.DIRECTORY_SEPARATOR);
|
||||||
$namespace = '';
|
$namespace = '';
|
||||||
}
|
}
|
||||||
if (count($paths) > 1) {
|
if (\count($paths) > 1) {
|
||||||
$rows[] = array('', '');
|
$rows[] = array('', '');
|
||||||
$prevHasSeparator = true;
|
$prevHasSeparator = true;
|
||||||
} else {
|
} else {
|
||||||
@ -159,7 +159,7 @@ EOF
|
|||||||
foreach ($loader->getNamespaces() as $namespace) {
|
foreach ($loader->getNamespaces() as $namespace) {
|
||||||
$paths = array_map(function ($path) {
|
$paths = array_map(function ($path) {
|
||||||
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
|
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
|
||||||
$path = ltrim(substr($path, strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
$path = ltrim(substr($path, \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $path;
|
return $path;
|
||||||
@ -190,16 +190,16 @@ EOF
|
|||||||
if (null === $cb) {
|
if (null === $cb) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_array($cb)) {
|
if (\is_array($cb)) {
|
||||||
if (!method_exists($cb[0], $cb[1])) {
|
if (!method_exists($cb[0], $cb[1])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$refl = new \ReflectionMethod($cb[0], $cb[1]);
|
$refl = new \ReflectionMethod($cb[0], $cb[1]);
|
||||||
} elseif (is_object($cb) && method_exists($cb, '__invoke')) {
|
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
|
||||||
$refl = new \ReflectionMethod($cb, '__invoke');
|
$refl = new \ReflectionMethod($cb, '__invoke');
|
||||||
} elseif (function_exists($cb)) {
|
} elseif (\function_exists($cb)) {
|
||||||
$refl = new \ReflectionFunction($cb);
|
$refl = new \ReflectionFunction($cb);
|
||||||
} elseif (is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
|
} elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
|
||||||
$refl = new \ReflectionMethod($m[1], $m[2]);
|
$refl = new \ReflectionMethod($m[1], $m[2]);
|
||||||
} else {
|
} else {
|
||||||
throw new \UnexpectedValueException('Unsupported callback type');
|
throw new \UnexpectedValueException('Unsupported callback type');
|
||||||
@ -249,8 +249,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('globals' === $type) {
|
if ('globals' === $type) {
|
||||||
if (is_object($meta)) {
|
if (\is_object($meta)) {
|
||||||
return ' = object('.get_class($meta).')';
|
return ' = object('.\get_class($meta).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ' = '.substr(@json_encode($meta), 0, 50);
|
return ' = '.substr(@json_encode($meta), 0, 50);
|
||||||
|
@ -77,7 +77,7 @@ EOF
|
|||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
$filenames = $input->getArgument('filename');
|
$filenames = $input->getArgument('filename');
|
||||||
|
|
||||||
if (0 === count($filenames)) {
|
if (0 === \count($filenames)) {
|
||||||
if (0 !== ftell(STDIN)) {
|
if (0 !== ftell(STDIN)) {
|
||||||
throw new RuntimeException('Please provide a filename or pipe template content to STDIN.');
|
throw new RuntimeException('Please provide a filename or pipe template content to STDIN.');
|
||||||
}
|
}
|
||||||
@ -162,9 +162,9 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (0 === $errors) {
|
if (0 === $errors) {
|
||||||
$io->success(sprintf('All %d Twig files contain valid syntax.', count($filesInfo)));
|
$io->success(sprintf('All %d Twig files contain valid syntax.', \count($filesInfo)));
|
||||||
} else {
|
} else {
|
||||||
$io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', count($filesInfo) - $errors, $errors));
|
$io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', \count($filesInfo) - $errors, $errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
return min($errors, 1);
|
return min($errors, 1);
|
||||||
@ -217,7 +217,7 @@ EOF
|
|||||||
$lines = explode("\n", $template);
|
$lines = explode("\n", $template);
|
||||||
|
|
||||||
$position = max(0, $line - $context);
|
$position = max(0, $line - $context);
|
||||||
$max = min(count($lines), $line - 1 + $context);
|
$max = min(\count($lines), $line - 1 + $context);
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
while ($position < $max) {
|
while ($position < $max) {
|
||||||
|
@ -35,7 +35,7 @@ class CodeExtension extends AbstractExtension
|
|||||||
public function __construct($fileLinkFormat, string $rootDir, string $charset, string $projectDir = null)
|
public function __construct($fileLinkFormat, string $rootDir, string $charset, string $projectDir = null)
|
||||||
{
|
{
|
||||||
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||||
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, dirname($rootDir)).DIRECTORY_SEPARATOR;
|
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, \dirname($rootDir)).DIRECTORY_SEPARATOR;
|
||||||
$this->charset = $charset;
|
$this->charset = $charset;
|
||||||
$this->projectDir = $projectDir;
|
$this->projectDir = $projectDir;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ class CodeExtension extends AbstractExtension
|
|||||||
$short = array_pop($parts);
|
$short = array_pop($parts);
|
||||||
$formattedValue = sprintf('<em>object</em>(<abbr title="%s">%s</abbr>)', $item[1], $short);
|
$formattedValue = sprintf('<em>object</em>(<abbr title="%s">%s</abbr>)', $item[1], $short);
|
||||||
} elseif ('array' === $item[0]) {
|
} elseif ('array' === $item[0]) {
|
||||||
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
|
$formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
|
||||||
} elseif ('null' === $item[0]) {
|
} elseif ('null' === $item[0]) {
|
||||||
$formattedValue = '<em>null</em>';
|
$formattedValue = '<em>null</em>';
|
||||||
} elseif ('boolean' === $item[0]) {
|
} elseif ('boolean' === $item[0]) {
|
||||||
@ -108,7 +108,7 @@ class CodeExtension extends AbstractExtension
|
|||||||
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset));
|
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
|
$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(', ', $result);
|
return implode(', ', $result);
|
||||||
@ -151,10 +151,10 @@ class CodeExtension extends AbstractExtension
|
|||||||
|
|
||||||
$lines = array();
|
$lines = array();
|
||||||
if (0 > $srcContext) {
|
if (0 > $srcContext) {
|
||||||
$srcContext = count($content);
|
$srcContext = \count($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, count($content)); $i <= $max; ++$i) {
|
for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, \count($content)); $i <= $max; ++$i) {
|
||||||
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><a class="anchor" name="line'.$i.'"></a><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
|
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><a class="anchor" name="line'.$i.'"></a><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ class CodeExtension extends AbstractExtension
|
|||||||
if (null === $text) {
|
if (null === $text) {
|
||||||
$text = str_replace('/', DIRECTORY_SEPARATOR, $file);
|
$text = str_replace('/', DIRECTORY_SEPARATOR, $file);
|
||||||
if (0 === strpos($text, $this->rootDir)) {
|
if (0 === strpos($text, $this->rootDir)) {
|
||||||
$text = substr($text, strlen($this->rootDir));
|
$text = substr($text, \strlen($this->rootDir));
|
||||||
$text = explode(DIRECTORY_SEPARATOR, $text, 2);
|
$text = explode(DIRECTORY_SEPARATOR, $text, 2);
|
||||||
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : '');
|
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : '');
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ class CodeExtension extends AbstractExtension
|
|||||||
public function getFileLink($file, $line)
|
public function getFileLink($file, $line)
|
||||||
{
|
{
|
||||||
if ($fmt = $this->fileLinkFormat) {
|
if ($fmt = $this->fileLinkFormat) {
|
||||||
return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
|
return \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -58,7 +58,7 @@ class DumpExtension extends AbstractExtension
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (2 === func_num_args()) {
|
if (2 === \func_num_args()) {
|
||||||
$vars = array();
|
$vars = array();
|
||||||
foreach ($context as $key => $value) {
|
foreach ($context as $key => $value) {
|
||||||
if (!$value instanceof Template) {
|
if (!$value instanceof Template) {
|
||||||
@ -68,7 +68,7 @@ class DumpExtension extends AbstractExtension
|
|||||||
|
|
||||||
$vars = array($vars);
|
$vars = array($vars);
|
||||||
} else {
|
} else {
|
||||||
$vars = func_get_args();
|
$vars = \func_get_args();
|
||||||
unset($vars[0], $vars[1]);
|
unset($vars[0], $vars[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ class FormExtension extends AbstractExtension
|
|||||||
*/
|
*/
|
||||||
function twig_is_selected_choice(ChoiceView $choice, $selectedValue)
|
function twig_is_selected_choice(ChoiceView $choice, $selectedValue)
|
||||||
{
|
{
|
||||||
if (is_array($selectedValue)) {
|
if (\is_array($selectedValue)) {
|
||||||
return in_array($choice->value, $selectedValue, true);
|
return \in_array($choice->value, $selectedValue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $choice->value === $selectedValue;
|
return $choice->value === $selectedValue;
|
||||||
|
@ -97,7 +97,7 @@ class HttpFoundationExtension extends AbstractExtension
|
|||||||
|
|
||||||
if (!$path || '/' !== $path[0]) {
|
if (!$path || '/' !== $path[0]) {
|
||||||
$prefix = $request->getPathInfo();
|
$prefix = $request->getPathInfo();
|
||||||
$last = strlen($prefix) - 1;
|
$last = \strlen($prefix) - 1;
|
||||||
if ($last !== $pos = strrpos($prefix, '/')) {
|
if ($last !== $pos = strrpos($prefix, '/')) {
|
||||||
$prefix = substr($prefix, 0, $pos).'/';
|
$prefix = substr($prefix, 0, $pos).'/';
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class RoutingExtension extends AbstractExtension
|
|||||||
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
|
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && count($paramsNode) <= 2 &&
|
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 &&
|
||||||
(!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
|
(!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
|
||||||
) {
|
) {
|
||||||
return array('html');
|
return array('html');
|
||||||
|
@ -42,7 +42,7 @@ class YamlExtension extends AbstractExtension
|
|||||||
$dumper = new YamlDumper();
|
$dumper = new YamlDumper();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
|
if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
|
||||||
return $dumper->dump($input, $inline, 0, $dumpObjects);
|
return $dumper->dump($input, $inline, 0, $dumpObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,12 +51,12 @@ class YamlExtension extends AbstractExtension
|
|||||||
|
|
||||||
public function dump($value, $inline = 0, $dumpObjects = false)
|
public function dump($value, $inline = 0, $dumpObjects = false)
|
||||||
{
|
{
|
||||||
if (is_resource($value)) {
|
if (\is_resource($value)) {
|
||||||
return '%Resource%';
|
return '%Resource%';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($value) || is_object($value)) {
|
if (\is_array($value) || \is_object($value)) {
|
||||||
return '%'.gettype($value).'% '.$this->encode($value, $inline, $dumpObjects);
|
return '%'.\gettype($value).'% '.$this->encode($value, $inline, $dumpObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->encode($value, $inline, $dumpObjects);
|
return $this->encode($value, $inline, $dumpObjects);
|
||||||
|
@ -98,7 +98,7 @@ class TwigRendererEngine extends AbstractRendererEngine
|
|||||||
|
|
||||||
// Check each theme whether it contains the searched block
|
// Check each theme whether it contains the searched block
|
||||||
if (isset($this->themes[$cacheKey])) {
|
if (isset($this->themes[$cacheKey])) {
|
||||||
for ($i = count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) {
|
for ($i = \count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) {
|
||||||
$this->loadResourcesFromTheme($cacheKey, $this->themes[$cacheKey][$i]);
|
$this->loadResourcesFromTheme($cacheKey, $this->themes[$cacheKey][$i]);
|
||||||
// CONTINUE LOADING (see doc comment)
|
// CONTINUE LOADING (see doc comment)
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ class TwigRendererEngine extends AbstractRendererEngine
|
|||||||
// Check the default themes once we reach the root view without success
|
// Check the default themes once we reach the root view without success
|
||||||
if (!$view->parent) {
|
if (!$view->parent) {
|
||||||
if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) {
|
if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) {
|
||||||
for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) {
|
for ($i = \count($this->defaultThemes) - 1; $i >= 0; --$i) {
|
||||||
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
|
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
|
||||||
// CONTINUE LOADING (see doc comment)
|
// CONTINUE LOADING (see doc comment)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
|||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($node instanceof FilterExpression && in_array($node->getNode('filter')->getAttribute('value'), array('trans', 'transchoice'))) {
|
if ($node instanceof FilterExpression && \in_array($node->getNode('filter')->getAttribute('value'), array('trans', 'transchoice'))) {
|
||||||
$arguments = $node->getNode('arguments');
|
$arguments = $node->getNode('arguments');
|
||||||
$ind = 'trans' === $node->getNode('filter')->getAttribute('value') ? 1 : 2;
|
$ind = 'trans' === $node->getNode('filter')->getAttribute('value') ? 1 : 2;
|
||||||
if ($this->isNamedArguments($arguments)) {
|
if ($this->isNamedArguments($arguments)) {
|
||||||
@ -119,7 +119,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
|||||||
private function isNamedArguments($arguments)
|
private function isNamedArguments($arguments)
|
||||||
{
|
{
|
||||||
foreach ($arguments as $name => $node) {
|
foreach ($arguments as $name => $node) {
|
||||||
if (!is_int($name)) {
|
if (!\is_int($name)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ TXT;
|
|||||||
|
|
||||||
private function createCommandTester(array $paths = array())
|
private function createCommandTester(array $paths = array())
|
||||||
{
|
{
|
||||||
$filesystemLoader = new FilesystemLoader(array(), dirname(__DIR__).'/Fixtures');
|
$filesystemLoader = new FilesystemLoader(array(), \dirname(__DIR__).'/Fixtures');
|
||||||
foreach ($paths as $namespace => $relDirs) {
|
foreach ($paths as $namespace => $relDirs) {
|
||||||
foreach ($relDirs as $relDir) {
|
foreach ($relDirs as $relDir) {
|
||||||
$filesystemLoader->addPath($relDir, $namespace);
|
$filesystemLoader->addPath($relDir, $namespace);
|
||||||
|
@ -76,7 +76,7 @@ class DumpExtensionTest extends TestCase
|
|||||||
array_unshift($args, $context);
|
array_unshift($args, $context);
|
||||||
array_unshift($args, $twig);
|
array_unshift($args, $twig);
|
||||||
|
|
||||||
$dump = call_user_func_array(array($extension, 'dump'), $args);
|
$dump = \call_user_func_array(array($extension, 'dump'), $args);
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
$this->assertStringStartsWith('<script>', $dump);
|
$this->assertStringStartsWith('<script>', $dump);
|
||||||
|
@ -56,7 +56,7 @@ class StopwatchExtensionTest extends TestCase
|
|||||||
|
|
||||||
protected function getStopwatch($events = array())
|
protected function getStopwatch($events = array())
|
||||||
{
|
{
|
||||||
$events = is_array($events) ? $events : array($events);
|
$events = \is_array($events) ? $events : array($events);
|
||||||
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
|
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
|
||||||
|
|
||||||
$i = -1;
|
$i = -1;
|
||||||
|
@ -206,7 +206,7 @@ class TranslationExtensionTest extends TestCase
|
|||||||
$translator = new Translator('en');
|
$translator = new Translator('en');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($template)) {
|
if (\is_array($template)) {
|
||||||
$loader = new TwigArrayLoader($template);
|
$loader = new TwigArrayLoader($template);
|
||||||
} else {
|
} else {
|
||||||
$loader = new TwigArrayLoader(array('index' => $template));
|
$loader = new TwigArrayLoader(array('index' => $template));
|
||||||
|
@ -90,7 +90,7 @@ class TwigExtractorTest extends TestCase
|
|||||||
$extractor->extract($resources, new MessageCatalogue('en'));
|
$extractor->extract($resources, new MessageCatalogue('en'));
|
||||||
} catch (Error $e) {
|
} catch (Error $e) {
|
||||||
if (method_exists($e, 'getSourceContext')) {
|
if (method_exists($e, 'getSourceContext')) {
|
||||||
$this->assertSame(dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
$this->assertSame(\dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||||
$this->assertSame(1, $e->getLine());
|
$this->assertSame(1, $e->getLine());
|
||||||
$this->assertSame('Unclosed "block".', $e->getMessage());
|
$this->assertSame('Unclosed "block".', $e->getMessage());
|
||||||
} else {
|
} else {
|
||||||
|
@ -169,7 +169,7 @@ class Client extends BaseClient
|
|||||||
foreach (get_declared_classes() as $class) {
|
foreach (get_declared_classes() as $class) {
|
||||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||||
$r = new \ReflectionClass($class);
|
$r = new \ReflectionClass($class);
|
||||||
$file = dirname(dirname($r->getFileName())).'/autoload.php';
|
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
|
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ EOT
|
|||||||
new TableSeparator(),
|
new TableSeparator(),
|
||||||
array('<info>Kernel</>'),
|
array('<info>Kernel</>'),
|
||||||
new TableSeparator(),
|
new TableSeparator(),
|
||||||
array('Type', get_class($kernel)),
|
array('Type', \get_class($kernel)),
|
||||||
array('Name', $kernel->getName()),
|
array('Name', $kernel->getName()),
|
||||||
array('Environment', $kernel->getEnvironment()),
|
array('Environment', $kernel->getEnvironment()),
|
||||||
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
|
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
|
||||||
@ -85,9 +85,9 @@ EOT
|
|||||||
array('Architecture', (PHP_INT_SIZE * 8).' bits'),
|
array('Architecture', (PHP_INT_SIZE * 8).' bits'),
|
||||||
array('Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'),
|
array('Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'),
|
||||||
array('Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'),
|
array('Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'),
|
||||||
array('OPcache', extension_loaded('Zend OPcache') && ini_get('opcache.enable') ? 'true' : 'false'),
|
array('OPcache', \extension_loaded('Zend OPcache') && ini_get('opcache.enable') ? 'true' : 'false'),
|
||||||
array('APCu', extension_loaded('apcu') && ini_get('apc.enabled') ? 'true' : 'false'),
|
array('APCu', \extension_loaded('apcu') && ini_get('apc.enabled') ? 'true' : 'false'),
|
||||||
array('Xdebug', extension_loaded('xdebug') ? 'true' : 'false'),
|
array('Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($dotenv = self::getDotenvVars()) {
|
if ($dotenv = self::getDotenvVars()) {
|
||||||
|
@ -109,7 +109,7 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$configuration instanceof ConfigurationInterface) {
|
if (!$configuration instanceof ConfigurationInterface) {
|
||||||
throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable', get_class($configuration)));
|
throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable', \get_class($configuration)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,8 +228,8 @@ EOT
|
|||||||
private function symlink(string $originDir, string $targetDir, bool $relative = false)
|
private function symlink(string $originDir, string $targetDir, bool $relative = false)
|
||||||
{
|
{
|
||||||
if ($relative) {
|
if ($relative) {
|
||||||
$this->filesystem->mkdir(dirname($targetDir));
|
$this->filesystem->mkdir(\dirname($targetDir));
|
||||||
$originDir = $this->filesystem->makePathRelative($originDir, realpath(dirname($targetDir)));
|
$originDir = $this->filesystem->makePathRelative($originDir, realpath(\dirname($targetDir)));
|
||||||
}
|
}
|
||||||
$this->filesystem->symlink($originDir, $targetDir);
|
$this->filesystem->symlink($originDir, $targetDir);
|
||||||
if (!file_exists($targetDir)) {
|
if (!file_exists($targetDir)) {
|
||||||
|
@ -95,7 +95,7 @@ EOF
|
|||||||
$this->getApplication()->setDispatcher(new EventDispatcher());
|
$this->getApplication()->setDispatcher(new EventDispatcher());
|
||||||
|
|
||||||
$containerFile = (new \ReflectionObject($kernel->getContainer()))->getFileName();
|
$containerFile = (new \ReflectionObject($kernel->getContainer()))->getFileName();
|
||||||
$containerDir = basename(dirname($containerFile));
|
$containerDir = basename(\dirname($containerFile));
|
||||||
|
|
||||||
// the warmup cache dir name must have the same length as the real one
|
// the warmup cache dir name must have the same length as the real one
|
||||||
// to avoid the many problems in serialized resources files
|
// to avoid the many problems in serialized resources files
|
||||||
@ -136,7 +136,7 @@ EOF
|
|||||||
|
|
||||||
if ('/' === \DIRECTORY_SEPARATOR && $mounts = @file('/proc/mounts')) {
|
if ('/' === \DIRECTORY_SEPARATOR && $mounts = @file('/proc/mounts')) {
|
||||||
foreach ($mounts as $mount) {
|
foreach ($mounts as $mount) {
|
||||||
$mount = array_slice(explode(' ', $mount), 1, -3);
|
$mount = \array_slice(explode(' ', $mount), 1, -3);
|
||||||
if (!\in_array(array_pop($mount), array('vboxsf', 'nfs'))) {
|
if (!\in_array(array_pop($mount), array('vboxsf', 'nfs'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ EOF
|
|||||||
$kernel = $this->getApplication()->getKernel();
|
$kernel = $this->getApplication()->getKernel();
|
||||||
|
|
||||||
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
|
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
|
||||||
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, get_class($kernel));
|
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
|
||||||
$container = $buildContainer();
|
$container = $buildContainer();
|
||||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||||
$container->compile();
|
$container->compile();
|
||||||
@ -219,7 +219,7 @@ EOF
|
|||||||
throw new InvalidArgumentException(sprintf('No services found that match "%s".', $name));
|
throw new InvalidArgumentException(sprintf('No services found that match "%s".', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
$default = 1 === count($matchingServices) ? $matchingServices[0] : null;
|
$default = 1 === \count($matchingServices) ? $matchingServices[0] : null;
|
||||||
|
|
||||||
return $io->choice('Select one of the following services to display its information', $matchingServices, $default);
|
return $io->choice('Select one of the following services to display its information', $matchingServices, $default);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ EOF
|
|||||||
|
|
||||||
if ($name) {
|
if ($name) {
|
||||||
if (!($route = $routes->get($name)) && $matchingRoutes = $this->findRouteNameContaining($name, $routes)) {
|
if (!($route = $routes->get($name)) && $matchingRoutes = $this->findRouteNameContaining($name, $routes)) {
|
||||||
$default = 1 === count($matchingRoutes) ? $matchingRoutes[0] : null;
|
$default = 1 === \count($matchingRoutes) ? $matchingRoutes[0] : null;
|
||||||
$name = $io->choice('Select one of the matching routes', $matchingRoutes, $default);
|
$name = $io->choice('Select one of the matching routes', $matchingRoutes, $default);
|
||||||
$route = $routes->get($name);
|
$route = $routes->get($name);
|
||||||
}
|
}
|
||||||
|
@ -219,8 +219,8 @@ EOF
|
|||||||
$states[] = self::MESSAGE_UNUSED;
|
$states[] = self::MESSAGE_UNUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array(self::MESSAGE_UNUSED, $states) && true === $input->getOption('only-unused')
|
if (!\in_array(self::MESSAGE_UNUSED, $states) && true === $input->getOption('only-unused')
|
||||||
|| !in_array(self::MESSAGE_MISSING, $states) && true === $input->getOption('only-missing')) {
|
|| !\in_array(self::MESSAGE_MISSING, $states) && true === $input->getOption('only-missing')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ EOF
|
|||||||
if (mb_strlen($string, $encoding) > $length) {
|
if (mb_strlen($string, $encoding) > $length) {
|
||||||
return mb_substr($string, 0, $length - 3, $encoding).'...';
|
return mb_substr($string, 0, $length - 3, $encoding).'...';
|
||||||
}
|
}
|
||||||
} elseif (strlen($string) > $length) {
|
} elseif (\strlen($string) > $length) {
|
||||||
return substr($string, 0, $length - 3).'...';
|
return substr($string, 0, $length - 3).'...';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ EOF
|
|||||||
|
|
||||||
// check format
|
// check format
|
||||||
$supportedFormats = $this->writer->getFormats();
|
$supportedFormats = $this->writer->getFormats();
|
||||||
if (!in_array($input->getOption('output-format'), $supportedFormats)) {
|
if (!\in_array($input->getOption('output-format'), $supportedFormats)) {
|
||||||
$errorIo->error(array('Wrong output format', 'Supported formats are: '.implode(', ', $supportedFormats).'.'));
|
$errorIo->error(array('Wrong output format', 'Supported formats are: '.implode(', ', $supportedFormats).'.'));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -190,7 +190,7 @@ EOF
|
|||||||
: new MergeOperation($currentCatalogue, $extractedCatalogue);
|
: new MergeOperation($currentCatalogue, $extractedCatalogue);
|
||||||
|
|
||||||
// Exit if no messages found.
|
// Exit if no messages found.
|
||||||
if (!count($operation->getDomains())) {
|
if (!\count($operation->getDomains())) {
|
||||||
$errorIo->warning('No translation messages were found.');
|
$errorIo->warning('No translation messages were found.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -216,7 +216,7 @@ EOF
|
|||||||
}, array_keys($operation->getObsoleteMessages($domain)))
|
}, array_keys($operation->getObsoleteMessages($domain)))
|
||||||
);
|
);
|
||||||
|
|
||||||
$domainMessagesCount = count($list);
|
$domainMessagesCount = \count($list);
|
||||||
|
|
||||||
$io->section(sprintf('Messages extracted for domain "<info>%s</info>" (%d message%s)', $domain, $domainMessagesCount, $domainMessagesCount > 1 ? 's' : ''));
|
$io->section(sprintf('Messages extracted for domain "<info>%s</info>" (%d message%s)', $domain, $domainMessagesCount, $domainMessagesCount > 1 ? 's' : ''));
|
||||||
$io->listing($list);
|
$io->listing($list);
|
||||||
|
@ -72,11 +72,11 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
case $object instanceof EventDispatcherInterface:
|
case $object instanceof EventDispatcherInterface:
|
||||||
$this->describeEventDispatcherListeners($object, $options);
|
$this->describeEventDispatcherListeners($object, $options);
|
||||||
break;
|
break;
|
||||||
case is_callable($object):
|
case \is_callable($object):
|
||||||
$this->describeCallable($object, $options);
|
$this->describeCallable($object, $options);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
|
throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,11 +181,11 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
*/
|
*/
|
||||||
protected function formatValue($value)
|
protected function formatValue($value)
|
||||||
{
|
{
|
||||||
if (is_object($value)) {
|
if (\is_object($value)) {
|
||||||
return sprintf('object(%s)', get_class($value));
|
return sprintf('object(%s)', \get_class($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($value)) {
|
if (\is_string($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
*/
|
*/
|
||||||
protected function formatParameter($value)
|
protected function formatParameter($value)
|
||||||
{
|
{
|
||||||
if (is_bool($value) || is_array($value) || (null === $value)) {
|
if (\is_bool($value) || \is_array($value) || (null === $value)) {
|
||||||
$jsonString = json_encode($value);
|
$jsonString = json_encode($value);
|
||||||
|
|
||||||
if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
|
if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
|
||||||
|
@ -90,7 +90,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
} elseif ($service instanceof Definition) {
|
} elseif ($service instanceof Definition) {
|
||||||
$this->writeData($this->getContainerDefinitionData($service, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']), $options);
|
$this->writeData($this->getContainerDefinitionData($service, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']), $options);
|
||||||
} else {
|
} else {
|
||||||
$this->writeData(get_class($service), $options);
|
$this->writeData(\get_class($service), $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
} elseif ($service instanceof Definition) {
|
} elseif ($service instanceof Definition) {
|
||||||
$data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments);
|
$data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments);
|
||||||
} else {
|
} else {
|
||||||
$data['services'][$serviceId] = get_class($service);
|
$data['services'][$serviceId] = \get_class($service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
'hostRegex' => '' !== $route->getHost() ? $route->compile()->getHostRegex() : '',
|
'hostRegex' => '' !== $route->getHost() ? $route->compile()->getHostRegex() : '',
|
||||||
'scheme' => $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY',
|
'scheme' => $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY',
|
||||||
'method' => $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY',
|
'method' => $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY',
|
||||||
'class' => get_class($route),
|
'class' => \get_class($route),
|
||||||
'defaults' => $route->getDefaults(),
|
'defaults' => $route->getDefaults(),
|
||||||
'requirements' => $route->getRequirements() ?: 'NO CUSTOM',
|
'requirements' => $route->getRequirements() ?: 'NO CUSTOM',
|
||||||
'options' => $route->getOptions(),
|
'options' => $route->getOptions(),
|
||||||
@ -227,7 +227,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
$data['file'] = $definition->getFile();
|
$data['file'] = $definition->getFile();
|
||||||
|
|
||||||
if ($factory = $definition->getFactory()) {
|
if ($factory = $definition->getFactory()) {
|
||||||
if (is_array($factory)) {
|
if (\is_array($factory)) {
|
||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
$data['factory_service'] = (string) $factory[0];
|
$data['factory_service'] = (string) $factory[0];
|
||||||
} elseif ($factory[0] instanceof Definition) {
|
} elseif ($factory[0] instanceof Definition) {
|
||||||
@ -242,7 +242,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
$calls = $definition->getMethodCalls();
|
$calls = $definition->getMethodCalls();
|
||||||
if (count($calls) > 0) {
|
if (\count($calls) > 0) {
|
||||||
$data['calls'] = array();
|
$data['calls'] = array();
|
||||||
foreach ($calls as $callData) {
|
foreach ($calls as $callData) {
|
||||||
$data['calls'][] = $callData[0];
|
$data['calls'][] = $callData[0];
|
||||||
@ -299,12 +299,12 @@ class JsonDescriptor extends Descriptor
|
|||||||
{
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
if (is_array($callable)) {
|
if (\is_array($callable)) {
|
||||||
$data['type'] = 'function';
|
$data['type'] = 'function';
|
||||||
|
|
||||||
if (is_object($callable[0])) {
|
if (\is_object($callable[0])) {
|
||||||
$data['name'] = $callable[1];
|
$data['name'] = $callable[1];
|
||||||
$data['class'] = get_class($callable[0]);
|
$data['class'] = \get_class($callable[0]);
|
||||||
} else {
|
} else {
|
||||||
if (0 !== strpos($callable[1], 'parent::')) {
|
if (0 !== strpos($callable[1], 'parent::')) {
|
||||||
$data['name'] = $callable[1];
|
$data['name'] = $callable[1];
|
||||||
@ -321,7 +321,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($callable)) {
|
if (\is_string($callable)) {
|
||||||
$data['type'] = 'function';
|
$data['type'] = 'function';
|
||||||
|
|
||||||
if (false === strpos($callable, '::')) {
|
if (false === strpos($callable, '::')) {
|
||||||
@ -345,7 +345,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
$data['type'] = 'object';
|
$data['type'] = 'object';
|
||||||
$data['name'] = get_class($callable);
|
$data['name'] = \get_class($callable);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
|
|
||||||
private function describeValue($value, $omitTags, $showArguments)
|
private function describeValue($value, $omitTags, $showArguments)
|
||||||
{
|
{
|
||||||
if (is_array($value)) {
|
if (\is_array($value)) {
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
$data[$k] = $this->describeValue($v, $omitTags, $showArguments);
|
$data[$k] = $this->describeValue($v, $omitTags, $showArguments);
|
||||||
|
@ -55,13 +55,13 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
."\n".'- Host Regex: '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')
|
."\n".'- Host Regex: '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')
|
||||||
."\n".'- Scheme: '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')
|
."\n".'- Scheme: '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')
|
||||||
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
|
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
|
||||||
."\n".'- Class: '.get_class($route)
|
."\n".'- Class: '.\get_class($route)
|
||||||
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
|
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
|
||||||
."\n".'- Requirements: '.($route->getRequirements() ? $this->formatRouterConfig($route->getRequirements()) : 'NO CUSTOM')
|
."\n".'- Requirements: '.($route->getRequirements() ? $this->formatRouterConfig($route->getRequirements()) : 'NO CUSTOM')
|
||||||
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
|
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
|
||||||
|
|
||||||
$this->write(isset($options['name'])
|
$this->write(isset($options['name'])
|
||||||
? $options['name']."\n".str_repeat('-', strlen($options['name']))."\n\n".$output
|
? $options['name']."\n".str_repeat('-', \strlen($options['name']))."\n\n".$output
|
||||||
: $output);
|
: $output);
|
||||||
$this->write("\n");
|
$this->write("\n");
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
$this->write("Container tags\n==============");
|
$this->write("Container tags\n==============");
|
||||||
|
|
||||||
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
||||||
$this->write("\n\n".$tag."\n".str_repeat('-', strlen($tag)));
|
$this->write("\n\n".$tag."\n".str_repeat('-', \strlen($tag)));
|
||||||
foreach ($definitions as $serviceId => $definition) {
|
foreach ($definitions as $serviceId => $definition) {
|
||||||
$this->write("\n\n");
|
$this->write("\n\n");
|
||||||
$this->describeContainerDefinition($definition, array('omit_tags' => true, 'id' => $serviceId));
|
$this->describeContainerDefinition($definition, array('omit_tags' => true, 'id' => $serviceId));
|
||||||
@ -110,7 +110,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
} elseif ($service instanceof Definition) {
|
} elseif ($service instanceof Definition) {
|
||||||
$this->describeContainerDefinition($service, $childOptions);
|
$this->describeContainerDefinition($service, $childOptions);
|
||||||
} else {
|
} else {
|
||||||
$this->write(sprintf('**`%s`:** `%s`', $options['id'], get_class($service)));
|
$this->write(sprintf('**`%s`:** `%s`', $options['id'], \get_class($service)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
if (isset($options['tag'])) {
|
if (isset($options['tag'])) {
|
||||||
$title .= ' with tag `'.$options['tag'].'`';
|
$title .= ' with tag `'.$options['tag'].'`';
|
||||||
}
|
}
|
||||||
$this->write($title."\n".str_repeat('=', strlen($title)));
|
$this->write($title."\n".str_repeat('=', \strlen($title)));
|
||||||
|
|
||||||
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
|
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
|
||||||
$showArguments = isset($options['show_arguments']) && $options['show_arguments'];
|
$showArguments = isset($options['show_arguments']) && $options['show_arguments'];
|
||||||
@ -171,7 +171,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
$this->write("\n\nServices\n--------\n");
|
$this->write("\n\nServices\n--------\n");
|
||||||
foreach ($services['services'] as $id => $service) {
|
foreach ($services['services'] as $id => $service) {
|
||||||
$this->write("\n");
|
$this->write("\n");
|
||||||
$this->write(sprintf('- `%s`: `%s`', $id, get_class($service)));
|
$this->write(sprintf('- `%s`: `%s`', $id, \get_class($service)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($factory = $definition->getFactory()) {
|
if ($factory = $definition->getFactory()) {
|
||||||
if (is_array($factory)) {
|
if (\is_array($factory)) {
|
||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
$output .= "\n".'- Factory Service: `'.$factory[0].'`';
|
$output .= "\n".'- Factory Service: `'.$factory[0].'`';
|
||||||
} elseif ($factory[0] instanceof Definition) {
|
} elseif ($factory[0] instanceof Definition) {
|
||||||
@ -260,7 +260,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerParameter($parameter, array $options = array())
|
protected function describeContainerParameter($parameter, array $options = array())
|
||||||
{
|
{
|
||||||
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', strlen($options['parameter'])), $this->formatParameter($parameter)) : $parameter);
|
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', \strlen($options['parameter'])), $this->formatParameter($parameter)) : $parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,12 +306,12 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
{
|
{
|
||||||
$string = '';
|
$string = '';
|
||||||
|
|
||||||
if (is_array($callable)) {
|
if (\is_array($callable)) {
|
||||||
$string .= "\n- Type: `function`";
|
$string .= "\n- Type: `function`";
|
||||||
|
|
||||||
if (is_object($callable[0])) {
|
if (\is_object($callable[0])) {
|
||||||
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
|
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
|
||||||
$string .= "\n".sprintf('- Class: `%s`', get_class($callable[0]));
|
$string .= "\n".sprintf('- Class: `%s`', \get_class($callable[0]));
|
||||||
} else {
|
} else {
|
||||||
if (0 !== strpos($callable[1], 'parent::')) {
|
if (0 !== strpos($callable[1], 'parent::')) {
|
||||||
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
|
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
|
||||||
@ -328,7 +328,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
return $this->write($string."\n");
|
return $this->write($string."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($callable)) {
|
if (\is_string($callable)) {
|
||||||
$string .= "\n- Type: `function`";
|
$string .= "\n- Type: `function`";
|
||||||
|
|
||||||
if (false === strpos($callable, '::')) {
|
if (false === strpos($callable, '::')) {
|
||||||
@ -352,7 +352,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
$string .= "\n- Type: `object`";
|
$string .= "\n- Type: `object`";
|
||||||
$string .= "\n".sprintf('- Name: `%s`', get_class($callable));
|
$string .= "\n".sprintf('- Name: `%s`', \get_class($callable));
|
||||||
|
|
||||||
return $this->write($string."\n");
|
return $this->write($string."\n");
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,8 @@ class TextDescriptor extends Descriptor
|
|||||||
$controller = $route->getDefault('_controller');
|
$controller = $route->getDefault('_controller');
|
||||||
if ($controller instanceof \Closure) {
|
if ($controller instanceof \Closure) {
|
||||||
$controller = 'Closure';
|
$controller = 'Closure';
|
||||||
} elseif (is_object($controller)) {
|
} elseif (\is_object($controller)) {
|
||||||
$controller = get_class($controller);
|
$controller = \get_class($controller);
|
||||||
}
|
}
|
||||||
$row[] = $controller;
|
$row[] = $controller;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ class TextDescriptor extends Descriptor
|
|||||||
array('Scheme', ($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')),
|
array('Scheme', ($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')),
|
||||||
array('Method', ($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')),
|
array('Method', ($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')),
|
||||||
array('Requirements', ($route->getRequirements() ? $this->formatRouterConfig($route->getRequirements()) : 'NO CUSTOM')),
|
array('Requirements', ($route->getRequirements() ? $this->formatRouterConfig($route->getRequirements()) : 'NO CUSTOM')),
|
||||||
array('Class', get_class($route)),
|
array('Class', \get_class($route)),
|
||||||
array('Defaults', $this->formatRouterConfig($route->getDefaults())),
|
array('Defaults', $this->formatRouterConfig($route->getDefaults())),
|
||||||
array('Options', $this->formatRouterConfig($route->getOptions())),
|
array('Options', $this->formatRouterConfig($route->getOptions())),
|
||||||
);
|
);
|
||||||
@ -155,7 +155,7 @@ class TextDescriptor extends Descriptor
|
|||||||
$options['output']->table(
|
$options['output']->table(
|
||||||
array('Service ID', 'Class'),
|
array('Service ID', 'Class'),
|
||||||
array(
|
array(
|
||||||
array(isset($options['id']) ? $options['id'] : '-', get_class($service)),
|
array(isset($options['id']) ? $options['id'] : '-', \get_class($service)),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -203,10 +203,10 @@ class TextDescriptor extends Descriptor
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
foreach ($tag as $key => $value) {
|
foreach ($tag as $key => $value) {
|
||||||
if (!isset($maxTags[$key])) {
|
if (!isset($maxTags[$key])) {
|
||||||
$maxTags[$key] = strlen($key);
|
$maxTags[$key] = \strlen($key);
|
||||||
}
|
}
|
||||||
if (strlen($value) > $maxTags[$key]) {
|
if (\strlen($value) > $maxTags[$key]) {
|
||||||
$maxTags[$key] = strlen($value);
|
$maxTags[$key] = \strlen($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tagsCount = count($maxTags);
|
$tagsCount = \count($maxTags);
|
||||||
$tagsNames = array_keys($maxTags);
|
$tagsNames = array_keys($maxTags);
|
||||||
|
|
||||||
$tableHeaders = array_merge(array('Service ID'), $tagsNames, array('Class name'));
|
$tableHeaders = array_merge(array('Service ID'), $tagsNames, array('Class name'));
|
||||||
@ -244,7 +244,7 @@ class TextDescriptor extends Descriptor
|
|||||||
$alias = $definition;
|
$alias = $definition;
|
||||||
$tableRows[] = array_merge(array($styledServiceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
|
$tableRows[] = array_merge(array($styledServiceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
|
||||||
} else {
|
} else {
|
||||||
$tableRows[] = array_merge(array($styledServiceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
|
$tableRows[] = array_merge(array($styledServiceId, \get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ class TextDescriptor extends Descriptor
|
|||||||
$tableRows[] = array('Tags', $tagInformation);
|
$tableRows[] = array('Tags', $tagInformation);
|
||||||
|
|
||||||
$calls = $definition->getMethodCalls();
|
$calls = $definition->getMethodCalls();
|
||||||
if (count($calls) > 0) {
|
if (\count($calls) > 0) {
|
||||||
$callInformation = array();
|
$callInformation = array();
|
||||||
foreach ($calls as $call) {
|
foreach ($calls as $call) {
|
||||||
$callInformation[] = $call[0];
|
$callInformation[] = $call[0];
|
||||||
@ -310,7 +310,7 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($factory = $definition->getFactory()) {
|
if ($factory = $definition->getFactory()) {
|
||||||
if (is_array($factory)) {
|
if (\is_array($factory)) {
|
||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
$tableRows[] = array('Factory Service', $factory[0]);
|
$tableRows[] = array('Factory Service', $factory[0]);
|
||||||
} elseif ($factory[0] instanceof Definition) {
|
} elseif ($factory[0] instanceof Definition) {
|
||||||
@ -334,13 +334,13 @@ class TextDescriptor extends Descriptor
|
|||||||
if ($argument instanceof Reference) {
|
if ($argument instanceof Reference) {
|
||||||
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument);
|
$argumentsInformation[] = sprintf('Service(%s)', (string) $argument);
|
||||||
} elseif ($argument instanceof IteratorArgument) {
|
} elseif ($argument instanceof IteratorArgument) {
|
||||||
$argumentsInformation[] = sprintf('Iterator (%d element(s))', count($argument->getValues()));
|
$argumentsInformation[] = sprintf('Iterator (%d element(s))', \count($argument->getValues()));
|
||||||
} elseif ($argument instanceof ServiceLocatorArgument) {
|
} elseif ($argument instanceof ServiceLocatorArgument) {
|
||||||
$argumentsInformation[] = sprintf('Service locator (%d element(s))', count($argument->getValues()));
|
$argumentsInformation[] = sprintf('Service locator (%d element(s))', \count($argument->getValues()));
|
||||||
} elseif ($argument instanceof Definition) {
|
} elseif ($argument instanceof Definition) {
|
||||||
$argumentsInformation[] = 'Inlined Service';
|
$argumentsInformation[] = 'Inlined Service';
|
||||||
} else {
|
} else {
|
||||||
$argumentsInformation[] = is_array($argument) ? sprintf('Array (%d element(s))', count($argument)) : $argument;
|
$argumentsInformation[] = \is_array($argument) ? sprintf('Array (%d element(s))', \count($argument)) : $argument;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,15 +447,15 @@ class TextDescriptor extends Descriptor
|
|||||||
|
|
||||||
private function formatCallable($callable): string
|
private function formatCallable($callable): string
|
||||||
{
|
{
|
||||||
if (is_array($callable)) {
|
if (\is_array($callable)) {
|
||||||
if (is_object($callable[0])) {
|
if (\is_object($callable[0])) {
|
||||||
return sprintf('%s::%s()', get_class($callable[0]), $callable[1]);
|
return sprintf('%s::%s()', \get_class($callable[0]), $callable[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf('%s::%s()', $callable[0], $callable[1]);
|
return sprintf('%s::%s()', $callable[0], $callable[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($callable)) {
|
if (\is_string($callable)) {
|
||||||
return sprintf('%s()', $callable);
|
return sprintf('%s()', $callable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +464,7 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
return sprintf('%s::__invoke()', get_class($callable));
|
return sprintf('%s::__invoke()', \get_class($callable));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException('Callable is not describable.');
|
throw new \InvalidArgumentException('Callable is not describable.');
|
||||||
|
@ -164,7 +164,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
$routeXML->setAttribute('name', $name);
|
$routeXML->setAttribute('name', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$routeXML->setAttribute('class', get_class($route));
|
$routeXML->setAttribute('class', \get_class($route));
|
||||||
|
|
||||||
$routeXML->appendChild($pathXML = $dom->createElement('path'));
|
$routeXML->appendChild($pathXML = $dom->createElement('path'));
|
||||||
$pathXML->setAttribute('regex', $route->compile()->getRegex());
|
$pathXML->setAttribute('regex', $route->compile()->getRegex());
|
||||||
@ -264,7 +264,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
} else {
|
} else {
|
||||||
$dom->appendChild($serviceXML = $dom->createElement('service'));
|
$dom->appendChild($serviceXML = $dom->createElement('service'));
|
||||||
$serviceXML->setAttribute('id', $id);
|
$serviceXML->setAttribute('id', $id);
|
||||||
$serviceXML->setAttribute('class', get_class($service));
|
$serviceXML->setAttribute('class', \get_class($service));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $dom;
|
return $dom;
|
||||||
@ -309,7 +309,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
if ($factory = $definition->getFactory()) {
|
if ($factory = $definition->getFactory()) {
|
||||||
$serviceXML->appendChild($factoryXML = $dom->createElement('factory'));
|
$serviceXML->appendChild($factoryXML = $dom->createElement('factory'));
|
||||||
|
|
||||||
if (is_array($factory)) {
|
if (\is_array($factory)) {
|
||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
$factoryXML->setAttribute('service', (string) $factory[0]);
|
$factoryXML->setAttribute('service', (string) $factory[0]);
|
||||||
} elseif ($factory[0] instanceof Definition) {
|
} elseif ($factory[0] instanceof Definition) {
|
||||||
@ -333,7 +333,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
$serviceXML->setAttribute('file', $definition->getFile());
|
$serviceXML->setAttribute('file', $definition->getFile());
|
||||||
|
|
||||||
$calls = $definition->getMethodCalls();
|
$calls = $definition->getMethodCalls();
|
||||||
if (count($calls) > 0) {
|
if (\count($calls) > 0) {
|
||||||
$serviceXML->appendChild($callsXML = $dom->createElement('calls'));
|
$serviceXML->appendChild($callsXML = $dom->createElement('calls'));
|
||||||
foreach ($calls as $callData) {
|
foreach ($calls as $callData) {
|
||||||
$callsXML->appendChild($callXML = $dom->createElement('call'));
|
$callsXML->appendChild($callXML = $dom->createElement('call'));
|
||||||
@ -377,7 +377,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
foreach ($arguments as $argumentKey => $argument) {
|
foreach ($arguments as $argumentKey => $argument) {
|
||||||
$argumentXML = $dom->createElement('argument');
|
$argumentXML = $dom->createElement('argument');
|
||||||
|
|
||||||
if (is_string($argumentKey)) {
|
if (\is_string($argumentKey)) {
|
||||||
$argumentXML->setAttribute('key', $argumentKey);
|
$argumentXML->setAttribute('key', $argumentKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
} elseif ($argument instanceof Definition) {
|
} elseif ($argument instanceof Definition) {
|
||||||
$argumentXML->appendChild($dom->importNode($this->getContainerDefinitionDocument($argument, null, false, true)->childNodes->item(0), true));
|
$argumentXML->appendChild($dom->importNode($this->getContainerDefinitionDocument($argument, null, false, true)->childNodes->item(0), true));
|
||||||
} elseif (is_array($argument)) {
|
} elseif (\is_array($argument)) {
|
||||||
$argumentXML->setAttribute('type', 'collection');
|
$argumentXML->setAttribute('type', 'collection');
|
||||||
|
|
||||||
foreach ($this->getArgumentNodes($argument, $dom) as $childArgumenXML) {
|
foreach ($this->getArgumentNodes($argument, $dom) as $childArgumenXML) {
|
||||||
@ -478,12 +478,12 @@ class XmlDescriptor extends Descriptor
|
|||||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||||
$dom->appendChild($callableXML = $dom->createElement('callable'));
|
$dom->appendChild($callableXML = $dom->createElement('callable'));
|
||||||
|
|
||||||
if (is_array($callable)) {
|
if (\is_array($callable)) {
|
||||||
$callableXML->setAttribute('type', 'function');
|
$callableXML->setAttribute('type', 'function');
|
||||||
|
|
||||||
if (is_object($callable[0])) {
|
if (\is_object($callable[0])) {
|
||||||
$callableXML->setAttribute('name', $callable[1]);
|
$callableXML->setAttribute('name', $callable[1]);
|
||||||
$callableXML->setAttribute('class', get_class($callable[0]));
|
$callableXML->setAttribute('class', \get_class($callable[0]));
|
||||||
} else {
|
} else {
|
||||||
if (0 !== strpos($callable[1], 'parent::')) {
|
if (0 !== strpos($callable[1], 'parent::')) {
|
||||||
$callableXML->setAttribute('name', $callable[1]);
|
$callableXML->setAttribute('name', $callable[1]);
|
||||||
@ -500,7 +500,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
return $dom;
|
return $dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($callable)) {
|
if (\is_string($callable)) {
|
||||||
$callableXML->setAttribute('type', 'function');
|
$callableXML->setAttribute('type', 'function');
|
||||||
|
|
||||||
if (false === strpos($callable, '::')) {
|
if (false === strpos($callable, '::')) {
|
||||||
@ -524,7 +524,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
$callableXML->setAttribute('type', 'object');
|
$callableXML->setAttribute('type', 'object');
|
||||||
$callableXML->setAttribute('name', get_class($callable));
|
$callableXML->setAttribute('name', \get_class($callable));
|
||||||
|
|
||||||
return $dom;
|
return $dom;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ abstract class AbstractController implements ServiceSubscriberInterface
|
|||||||
protected function getParameter(string $name)
|
protected function getParameter(string $name)
|
||||||
{
|
{
|
||||||
if (!$this->container->has('parameter_bag')) {
|
if (!$this->container->has('parameter_bag')) {
|
||||||
throw new ServiceNotFoundException('parameter_bag', null, null, array(), sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.', get_class($this)));
|
throw new ServiceNotFoundException('parameter_bag', null, null, array(), sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.', \get_class($this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->container->get('parameter_bag')->get($name);
|
return $this->container->get('parameter_bag')->get($name);
|
||||||
|
@ -44,12 +44,12 @@ class ControllerNameParser
|
|||||||
*/
|
*/
|
||||||
public function parse($controller)
|
public function parse($controller)
|
||||||
{
|
{
|
||||||
if (2 > func_num_args() || func_get_arg(1)) {
|
if (2 > \func_num_args() || func_get_arg(1)) {
|
||||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.1.', __CLASS__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.1.', __CLASS__), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode(':', $controller);
|
$parts = explode(':', $controller);
|
||||||
if (3 !== count($parts) || in_array('', $parts, true)) {
|
if (3 !== \count($parts) || \in_array('', $parts, true)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The "%s" controller is not a valid "a:b:c" controller string.', $controller));
|
throw new \InvalidArgumentException(sprintf('The "%s" controller is not a valid "a:b:c" controller string.', $controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class ControllerNameParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lev = levenshtein($nonExistentBundleName, $bundleName);
|
$lev = levenshtein($nonExistentBundleName, $bundleName);
|
||||||
if ($lev <= strlen($nonExistentBundleName) / 3 && (null === $alternative || $lev < $shortest)) {
|
if ($lev <= \strlen($nonExistentBundleName) / 3 && (null === $alternative || $lev < $shortest)) {
|
||||||
$alternative = $bundleName;
|
$alternative = $bundleName;
|
||||||
$shortest = $lev;
|
$shortest = $lev;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ trait ControllerTrait
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_object($user = $token->getUser())) {
|
if (!\is_object($user = $token->getUser())) {
|
||||||
// e.g. anonymous authentication
|
// e.g. anonymous authentication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class RedirectController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
if (false === $ignoreAttributes || is_array($ignoreAttributes)) {
|
if (false === $ignoreAttributes || \is_array($ignoreAttributes)) {
|
||||||
$attributes = $request->attributes->get('_route_params');
|
$attributes = $request->attributes->get('_route_params');
|
||||||
$attributes = $keepQueryParams ? array_merge($request->query->all(), $attributes) : $attributes;
|
$attributes = $keepQueryParams ? array_merge($request->query->all(), $attributes) : $attributes;
|
||||||
unset($attributes['route'], $attributes['permanent'], $attributes['ignoreAttributes'], $attributes['keepRequestMethod'], $attributes['keepQueryParams']);
|
unset($attributes['route'], $attributes['permanent'], $attributes['ignoreAttributes'], $attributes['keepRequestMethod'], $attributes['keepQueryParams']);
|
||||||
|
@ -24,7 +24,7 @@ class RouterDataCollector extends BaseRouterDataCollector
|
|||||||
{
|
{
|
||||||
public function guessRoute(Request $request, $controller)
|
public function guessRoute(Request $request, $controller)
|
||||||
{
|
{
|
||||||
if (is_array($controller)) {
|
if (\is_array($controller)) {
|
||||||
$controller = $controller[0];
|
$controller = $controller[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class TemplatingPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($helpers) > 0) {
|
if (\count($helpers) > 0) {
|
||||||
$definition = $container->getDefinition('templating.engine.php');
|
$definition = $container->getDefinition('templating.engine.php');
|
||||||
$definition->addMethodCall('setHelpers', array($helpers));
|
$definition->addMethodCall('setHelpers', array($helpers));
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class UnusedTagsPass implements CompilerPassInterface
|
|||||||
|
|
||||||
foreach ($container->findUnusedTags() as $tag) {
|
foreach ($container->findUnusedTags() as $tag) {
|
||||||
// skip whitelisted tags
|
// skip whitelisted tags
|
||||||
if (in_array($tag, $this->whitelist)) {
|
if (\in_array($tag, $this->whitelist)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class UnusedTagsPass implements CompilerPassInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== strpos($definedTag, $tag) || levenshtein($tag, $definedTag) <= strlen($tag) / 3) {
|
if (false !== strpos($definedTag, $tag) || levenshtein($tag, $definedTag) <= \strlen($tag) / 3) {
|
||||||
$candidates[] = $definedTag;
|
$candidates[] = $definedTag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
$workflows = $v;
|
$workflows = $v;
|
||||||
unset($workflows['enabled']);
|
unset($workflows['enabled']);
|
||||||
|
|
||||||
if (1 === count($workflows) && isset($workflows[0]['enabled'])) {
|
if (1 === \count($workflows) && isset($workflows[0]['enabled'])) {
|
||||||
$workflows = array();
|
$workflows = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,19 +300,19 @@ class Configuration implements ConfigurationInterface
|
|||||||
->always()
|
->always()
|
||||||
->then(function ($places) {
|
->then(function ($places) {
|
||||||
// It's an indexed array of shape ['place1', 'place2']
|
// It's an indexed array of shape ['place1', 'place2']
|
||||||
if (isset($places[0]) && is_string($places[0])) {
|
if (isset($places[0]) && \is_string($places[0])) {
|
||||||
return array_map(function (string $place) {
|
return array_map(function (string $place) {
|
||||||
return array('name' => $place);
|
return array('name' => $place);
|
||||||
}, $places);
|
}, $places);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's an indexed array, we let the validation occur
|
// It's an indexed array, we let the validation occur
|
||||||
if (isset($places[0]) && is_array($places[0])) {
|
if (isset($places[0]) && \is_array($places[0])) {
|
||||||
return $places;
|
return $places;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($places as $name => $place) {
|
foreach ($places as $name => $place) {
|
||||||
if (is_array($place) && array_key_exists('name', $place)) {
|
if (\is_array($place) && array_key_exists('name', $place)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$place['name'] = $name;
|
$place['name'] = $name;
|
||||||
@ -345,12 +345,12 @@ class Configuration implements ConfigurationInterface
|
|||||||
->always()
|
->always()
|
||||||
->then(function ($transitions) {
|
->then(function ($transitions) {
|
||||||
// It's an indexed array, we let the validation occur
|
// It's an indexed array, we let the validation occur
|
||||||
if (isset($transitions[0]) && is_array($transitions[0])) {
|
if (isset($transitions[0]) && \is_array($transitions[0])) {
|
||||||
return $transitions;
|
return $transitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($transitions as $name => $transition) {
|
foreach ($transitions as $name => $transition) {
|
||||||
if (is_array($transition) && array_key_exists('name', $transition)) {
|
if (\is_array($transition) && array_key_exists('name', $transition)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$transition['name'] = $name;
|
$transition['name'] = $name;
|
||||||
@ -512,11 +512,11 @@ class Configuration implements ConfigurationInterface
|
|||||||
->useAttributeAsKey('name')
|
->useAttributeAsKey('name')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return is_array($v) && isset($v['mime_type']); })
|
->ifTrue(function ($v) { return \is_array($v) && isset($v['mime_type']); })
|
||||||
->then(function ($v) { return $v['mime_type']; })
|
->then(function ($v) { return $v['mime_type']; })
|
||||||
->end()
|
->end()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !is_array($v); })
|
->ifTrue(function ($v) { return !\is_array($v); })
|
||||||
->then(function ($v) { return array($v); })
|
->then(function ($v) { return array($v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
@ -536,7 +536,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->info('templating configuration')
|
->info('templating configuration')
|
||||||
->canBeEnabled()
|
->canBeEnabled()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return false === $v || is_array($v) && false === $v['enabled']; })
|
->ifTrue(function ($v) { return false === $v || \is_array($v) && false === $v['enabled']; })
|
||||||
->then(function () { return array('enabled' => false, 'engines' => false); })
|
->then(function () { return array('enabled' => false, 'engines' => false); })
|
||||||
->end()
|
->end()
|
||||||
->children()
|
->children()
|
||||||
@ -550,7 +550,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->addDefaultChildrenIfNoneSet()
|
->addDefaultChildrenIfNoneSet()
|
||||||
->prototype('scalar')->defaultValue('FrameworkBundle:Form')->end()
|
->prototype('scalar')->defaultValue('FrameworkBundle:Form')->end()
|
||||||
->validate()
|
->validate()
|
||||||
->ifTrue(function ($v) {return !in_array('FrameworkBundle:Form', $v); })
|
->ifTrue(function ($v) {return !\in_array('FrameworkBundle:Form', $v); })
|
||||||
->then(function ($v) {
|
->then(function ($v) {
|
||||||
return array_merge(array('FrameworkBundle:Form'), $v);
|
return array_merge(array('FrameworkBundle:Form'), $v);
|
||||||
})
|
})
|
||||||
@ -567,7 +567,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->canBeUnset()
|
->canBeUnset()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !is_array($v) && false !== $v; })
|
->ifTrue(function ($v) { return !\is_array($v) && false !== $v; })
|
||||||
->then(function ($v) { return array($v); })
|
->then(function ($v) { return array($v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
@ -577,7 +577,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->children()
|
->children()
|
||||||
->arrayNode('loaders')
|
->arrayNode('loaders')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !is_array($v); })
|
->ifTrue(function ($v) { return !\is_array($v); })
|
||||||
->then(function ($v) { return array($v); })
|
->then(function ($v) { return array($v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
@ -605,7 +605,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->arrayNode('base_urls')
|
->arrayNode('base_urls')
|
||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !is_array($v); })
|
->ifTrue(function ($v) { return !\is_array($v); })
|
||||||
->then(function ($v) { return array($v); })
|
->then(function ($v) { return array($v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
@ -649,7 +649,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->arrayNode('base_urls')
|
->arrayNode('base_urls')
|
||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return !is_array($v); })
|
->ifTrue(function ($v) { return !\is_array($v); })
|
||||||
->then(function ($v) { return array($v); })
|
->then(function ($v) { return array($v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
@ -747,7 +747,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
->treatFalseLike(array())
|
->treatFalseLike(array())
|
||||||
->validate()
|
->validate()
|
||||||
->ifTrue(function ($v) { return !is_array($v); })
|
->ifTrue(function ($v) { return !\is_array($v); })
|
||||||
->then(function ($v) { return (array) $v; })
|
->then(function ($v) { return (array) $v; })
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
@ -933,7 +933,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->ifString()->then(function ($v) { return array('enabled' => true, 'resources' => $v); })
|
->ifString()->then(function ($v) { return array('enabled' => true, 'resources' => $v); })
|
||||||
->end()
|
->end()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return is_array($v) && !isset($v['resources']); })
|
->ifTrue(function ($v) { return \is_array($v) && !isset($v['resources']); })
|
||||||
->then(function ($v) {
|
->then(function ($v) {
|
||||||
$e = $v['enabled'];
|
$e = $v['enabled'];
|
||||||
unset($v['enabled']);
|
unset($v['enabled']);
|
||||||
@ -951,7 +951,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->ifString()->then(function ($v) { return array('default' => $v); })
|
->ifString()->then(function ($v) { return array('default' => $v); })
|
||||||
->end()
|
->end()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return is_array($v) && array_keys($v) === range(0, count($v) - 1); })
|
->ifTrue(function ($v) { return \is_array($v) && array_keys($v) === range(0, \count($v) - 1); })
|
||||||
->then(function ($v) { return array('default' => $v); })
|
->then(function ($v) { return array('default' => $v); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
|
@ -121,7 +121,7 @@ class FrameworkExtension extends Extension
|
|||||||
*/
|
*/
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config'));
|
$loader = new XmlFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config'));
|
||||||
|
|
||||||
$loader->load('web.xml');
|
$loader->load('web.xml');
|
||||||
$loader->load('services.xml');
|
$loader->load('services.xml');
|
||||||
@ -805,7 +805,7 @@ class FrameworkExtension extends Extension
|
|||||||
$loaders = array_map(function ($loader) { return new Reference($loader); }, $config['loaders']);
|
$loaders = array_map(function ($loader) { return new Reference($loader); }, $config['loaders']);
|
||||||
|
|
||||||
// Use a delegation unless only a single loader was registered
|
// Use a delegation unless only a single loader was registered
|
||||||
if (1 === count($loaders)) {
|
if (1 === \count($loaders)) {
|
||||||
$container->setAlias('templating.loader', (string) reset($loaders))->setPrivate(true);
|
$container->setAlias('templating.loader', (string) reset($loaders))->setPrivate(true);
|
||||||
} else {
|
} else {
|
||||||
$container->getDefinition('templating.loader.chain')->addArgument($loaders);
|
$container->getDefinition('templating.loader.chain')->addArgument($loaders);
|
||||||
@ -827,7 +827,7 @@ class FrameworkExtension extends Extension
|
|||||||
$engines = array_map(function ($engine) { return new Reference('templating.engine.'.$engine); }, $config['engines']);
|
$engines = array_map(function ($engine) { return new Reference('templating.engine.'.$engine); }, $config['engines']);
|
||||||
|
|
||||||
// Use a delegation unless only a single engine was registered
|
// Use a delegation unless only a single engine was registered
|
||||||
if (1 === count($engines)) {
|
if (1 === \count($engines)) {
|
||||||
$container->setAlias('templating', (string) reset($engines))->setPublic(true);
|
$container->setAlias('templating', (string) reset($engines))->setPublic(true);
|
||||||
} else {
|
} else {
|
||||||
$templateEngineDefinition = $container->getDefinition('templating.engine.delegating');
|
$templateEngineDefinition = $container->getDefinition('templating.engine.delegating');
|
||||||
@ -843,7 +843,7 @@ class FrameworkExtension extends Extension
|
|||||||
;
|
;
|
||||||
|
|
||||||
// configure the PHP engine if needed
|
// configure the PHP engine if needed
|
||||||
if (in_array('php', $config['engines'], true)) {
|
if (\in_array('php', $config['engines'], true)) {
|
||||||
$loader->load('templating_php.xml');
|
$loader->load('templating_php.xml');
|
||||||
|
|
||||||
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
|
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
|
||||||
@ -975,17 +975,17 @@ class FrameworkExtension extends Extension
|
|||||||
if (class_exists('Symfony\Component\Validator\Validation')) {
|
if (class_exists('Symfony\Component\Validator\Validation')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Validator\Validation');
|
$r = new \ReflectionClass('Symfony\Component\Validator\Validation');
|
||||||
|
|
||||||
$dirs[] = dirname($r->getFileName()).'/Resources/translations';
|
$dirs[] = \dirname($r->getFileName()).'/Resources/translations';
|
||||||
}
|
}
|
||||||
if (class_exists('Symfony\Component\Form\Form')) {
|
if (class_exists('Symfony\Component\Form\Form')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Form\Form');
|
$r = new \ReflectionClass('Symfony\Component\Form\Form');
|
||||||
|
|
||||||
$dirs[] = dirname($r->getFileName()).'/Resources/translations';
|
$dirs[] = \dirname($r->getFileName()).'/Resources/translations';
|
||||||
}
|
}
|
||||||
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
||||||
|
|
||||||
$dirs[] = dirname(dirname($r->getFileName())).'/Resources/translations';
|
$dirs[] = \dirname(\dirname($r->getFileName())).'/Resources/translations';
|
||||||
}
|
}
|
||||||
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
|
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
|
||||||
$rootDir = $container->getParameter('kernel.root_dir');
|
$rootDir = $container->getParameter('kernel.root_dir');
|
||||||
@ -1105,7 +1105,7 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if (interface_exists('Symfony\Component\Form\FormInterface')) {
|
if (interface_exists('Symfony\Component\Form\FormInterface')) {
|
||||||
$reflClass = new \ReflectionClass('Symfony\Component\Form\FormInterface');
|
$reflClass = new \ReflectionClass('Symfony\Component\Form\FormInterface');
|
||||||
$fileRecorder('xml', dirname($reflClass->getFileName()).'/Resources/config/validation.xml');
|
$fileRecorder('xml', \dirname($reflClass->getFileName()).'/Resources/config/validation.xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {
|
foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {
|
||||||
@ -1300,7 +1300,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fileRecorder = function ($extension, $path) use (&$serializerLoaders) {
|
$fileRecorder = function ($extension, $path) use (&$serializerLoaders) {
|
||||||
$definition = new Definition(in_array($extension, array('yaml', 'yml')) ? 'Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader' : 'Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($path));
|
$definition = new Definition(\in_array($extension, array('yaml', 'yml')) ? 'Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader' : 'Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($path));
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
$serializerLoaders[] = $definition;
|
$serializerLoaders[] = $definition;
|
||||||
};
|
};
|
||||||
@ -1378,7 +1378,7 @@ class FrameworkExtension extends Extension
|
|||||||
$loader->load('lock.xml');
|
$loader->load('lock.xml');
|
||||||
|
|
||||||
foreach ($config['resources'] as $resourceName => $resourceStores) {
|
foreach ($config['resources'] as $resourceName => $resourceStores) {
|
||||||
if (0 === count($resourceStores)) {
|
if (0 === \count($resourceStores)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,7 +1419,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrap array of stores with CombinedStore
|
// Wrap array of stores with CombinedStore
|
||||||
if (count($storeDefinitions) > 1) {
|
if (\count($storeDefinitions) > 1) {
|
||||||
$combinedDefinition = new ChildDefinition('lock.store.combined.abstract');
|
$combinedDefinition = new ChildDefinition('lock.store.combined.abstract');
|
||||||
$combinedDefinition->replaceArgument(0, $storeDefinitions);
|
$combinedDefinition->replaceArgument(0, $storeDefinitions);
|
||||||
$container->setDefinition('lock.'.$resourceName.'.store', $combinedDefinition);
|
$container->setDefinition('lock.'.$resourceName.'.store', $combinedDefinition);
|
||||||
@ -1633,7 +1633,7 @@ class FrameworkExtension extends Extension
|
|||||||
*/
|
*/
|
||||||
public function getXsdValidationBasePath()
|
public function getXsdValidationBasePath()
|
||||||
{
|
{
|
||||||
return dirname(__DIR__).'/Resources/config/schema';
|
return \dirname(__DIR__).'/Resources/config/schema';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNamespace()
|
public function getNamespace()
|
||||||
|
@ -35,7 +35,7 @@ class ResolveControllerNameSubscriber implements EventSubscriberInterface
|
|||||||
public function onKernelRequest(GetResponseEvent $event)
|
public function onKernelRequest(GetResponseEvent $event)
|
||||||
{
|
{
|
||||||
$controller = $event->getRequest()->attributes->get('_controller');
|
$controller = $event->getRequest()->attributes->get('_controller');
|
||||||
if (is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
|
if (\is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
|
||||||
// controller in the a:b:c notation then
|
// controller in the a:b:c notation then
|
||||||
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller, false));
|
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller, false));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class DelegatingLoader extends BaseDelegatingLoader
|
|||||||
if ($this->defaultOptions) {
|
if ($this->defaultOptions) {
|
||||||
$route->setOptions($route->getOptions() + $this->defaultOptions);
|
$route->setOptions($route->getOptions() + $this->defaultOptions);
|
||||||
}
|
}
|
||||||
if (!is_string($controller = $route->getDefault('_controller'))) {
|
if (!\is_string($controller = $route->getDefault('_controller'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
|||||||
*/
|
*/
|
||||||
private function resolve($value)
|
private function resolve($value)
|
||||||
{
|
{
|
||||||
if (is_array($value)) {
|
if (\is_array($value)) {
|
||||||
foreach ($value as $key => $val) {
|
foreach ($value as $key => $val) {
|
||||||
$value[$key] = $this->resolve($val);
|
$value[$key] = $this->resolve($val);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_string($value)) {
|
if (!\is_string($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
|||||||
|
|
||||||
$resolved = ($this->paramFetcher)($match[1]);
|
$resolved = ($this->paramFetcher)($match[1]);
|
||||||
|
|
||||||
if (is_string($resolved) || is_numeric($resolved)) {
|
if (\is_string($resolved) || is_numeric($resolved)) {
|
||||||
$this->collectedParameters[$match[1]] = $resolved;
|
$this->collectedParameters[$match[1]] = $resolved;
|
||||||
|
|
||||||
return (string) $resolved;
|
return (string) $resolved;
|
||||||
@ -175,7 +175,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
|||||||
'must be a string or numeric, but it is of type %s.',
|
'must be a string or numeric, but it is of type %s.',
|
||||||
$match[1],
|
$match[1],
|
||||||
$value,
|
$value,
|
||||||
gettype($resolved)
|
\gettype($resolved)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}, $value);
|
}, $value);
|
||||||
|
@ -66,7 +66,7 @@ class DelegatingEngine extends BaseDelegatingEngine implements EngineInterface
|
|||||||
private function resolveEngines()
|
private function resolveEngines()
|
||||||
{
|
{
|
||||||
foreach ($this->engines as $i => $engine) {
|
foreach ($this->engines as $i => $engine) {
|
||||||
if (is_string($engine)) {
|
if (\is_string($engine)) {
|
||||||
$this->engines[$i] = $this->container->get($engine);
|
$this->engines[$i] = $this->container->get($engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class GlobalVariables
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user = $token->getUser();
|
$user = $token->getUser();
|
||||||
if (!is_object($user)) {
|
if (!\is_object($user)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class CodeHelper extends Helper
|
|||||||
$short = array_pop($parts);
|
$short = array_pop($parts);
|
||||||
$formattedValue = sprintf('<em>object</em>(<abbr title="%s">%s</abbr>)', $item[1], $short);
|
$formattedValue = sprintf('<em>object</em>(<abbr title="%s">%s</abbr>)', $item[1], $short);
|
||||||
} elseif ('array' === $item[0]) {
|
} elseif ('array' === $item[0]) {
|
||||||
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
|
$formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
|
||||||
} elseif ('string' === $item[0]) {
|
} elseif ('string' === $item[0]) {
|
||||||
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
|
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
|
||||||
} elseif ('null' === $item[0]) {
|
} elseif ('null' === $item[0]) {
|
||||||
@ -98,7 +98,7 @@ class CodeHelper extends Helper
|
|||||||
$formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES, $this->getCharset()), true));
|
$formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES, $this->getCharset()), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
|
$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(', ', $result);
|
return implode(', ', $result);
|
||||||
@ -115,7 +115,7 @@ class CodeHelper extends Helper
|
|||||||
public function fileExcerpt($file, $line)
|
public function fileExcerpt($file, $line)
|
||||||
{
|
{
|
||||||
if (is_readable($file)) {
|
if (is_readable($file)) {
|
||||||
if (extension_loaded('fileinfo')) {
|
if (\extension_loaded('fileinfo')) {
|
||||||
$finfo = new \finfo();
|
$finfo = new \finfo();
|
||||||
|
|
||||||
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
|
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
|
||||||
@ -132,7 +132,7 @@ class CodeHelper extends Helper
|
|||||||
$content = explode('<br />', $code);
|
$content = explode('<br />', $code);
|
||||||
|
|
||||||
$lines = array();
|
$lines = array();
|
||||||
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
|
for ($i = max($line - 3, 1), $max = min($line + 3, \count($content)); $i <= $max; ++$i) {
|
||||||
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
|
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ class CodeHelper extends Helper
|
|||||||
public function getFileLink($file, $line)
|
public function getFileLink($file, $line)
|
||||||
{
|
{
|
||||||
if ($fmt = $this->fileLinkFormat) {
|
if ($fmt = $this->fileLinkFormat) {
|
||||||
return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
|
return \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -37,7 +37,7 @@ class StopwatchHelper extends Helper
|
|||||||
{
|
{
|
||||||
if (null !== $this->stopwatch) {
|
if (null !== $this->stopwatch) {
|
||||||
if (method_exists($this->stopwatch, $method)) {
|
if (method_exists($this->stopwatch, $method)) {
|
||||||
return call_user_func_array(array($this->stopwatch, $method), $arguments);
|
return \call_user_func_array(array($this->stopwatch, $method), $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
||||||
|
@ -46,7 +46,7 @@ class PhpEngine extends BasePhpEngine implements EngineInterface
|
|||||||
throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
|
throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($this->helpers[$name])) {
|
if (\is_string($this->helpers[$name])) {
|
||||||
$this->helpers[$name] = $this->container->get($this->helpers[$name]);
|
$this->helpers[$name] = $this->container->get($this->helpers[$name]);
|
||||||
$this->helpers[$name]->setCharset($this->charset);
|
$this->helpers[$name]->setCharset($this->charset);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class TemplateFilenameParser implements TemplateNameParserInterface
|
|||||||
$parts = explode('/', str_replace('\\', '/', $name));
|
$parts = explode('/', str_replace('\\', '/', $name));
|
||||||
|
|
||||||
$elements = explode('.', array_pop($parts));
|
$elements = explode('.', array_pop($parts));
|
||||||
if (3 > count($elements)) {
|
if (3 > \count($elements)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$engine = array_pop($elements);
|
$engine = array_pop($elements);
|
||||||
|
@ -39,7 +39,7 @@ class SerializerCacheWarmerTest extends TestCase
|
|||||||
$fallbackPool = new ArrayAdapter();
|
$fallbackPool = new ArrayAdapter();
|
||||||
|
|
||||||
$warmer = new SerializerCacheWarmer($loaders, $file, $fallbackPool);
|
$warmer = new SerializerCacheWarmer($loaders, $file, $fallbackPool);
|
||||||
$warmer->warmUp(dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class SerializerCacheWarmerTest extends TestCase
|
|||||||
$fallbackPool = new ArrayAdapter();
|
$fallbackPool = new ArrayAdapter();
|
||||||
|
|
||||||
$warmer = new SerializerCacheWarmer(array(), $file, $fallbackPool);
|
$warmer = new SerializerCacheWarmer(array(), $file, $fallbackPool);
|
||||||
$warmer->warmUp(dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class TemplatePathsCacheWarmerTest extends TestCase
|
|||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('locate')
|
->method('locate')
|
||||||
->with($template->getPath())
|
->with($template->getPath())
|
||||||
->will($this->returnValue(dirname($this->tmpDir).'/path/to/template.html.twig'));
|
->will($this->returnValue(\dirname($this->tmpDir).'/path/to/template.html.twig'));
|
||||||
|
|
||||||
$warmer = new TemplatePathsCacheWarmer($this->templateFinder, $this->templateLocator);
|
$warmer = new TemplatePathsCacheWarmer($this->templateFinder, $this->templateLocator);
|
||||||
$warmer->warmUp($this->tmpDir);
|
$warmer->warmUp($this->tmpDir);
|
||||||
|
@ -35,7 +35,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$fallbackPool = new ArrayAdapter();
|
$fallbackPool = new ArrayAdapter();
|
||||||
|
|
||||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
||||||
$warmer->warmUp(dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$fallbackPool = new ArrayAdapter();
|
$fallbackPool = new ArrayAdapter();
|
||||||
|
|
||||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
||||||
$warmer->warmUp(dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$fallbackPool = new ArrayAdapter();
|
$fallbackPool = new ArrayAdapter();
|
||||||
|
|
||||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
||||||
$warmer->warmUp(dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class CacheClearCommandTest extends TestCase
|
|||||||
// check that app kernel file present in meta file of container's cache
|
// check that app kernel file present in meta file of container's cache
|
||||||
$containerClass = $this->kernel->getContainer()->getParameter('kernel.container_class');
|
$containerClass = $this->kernel->getContainer()->getParameter('kernel.container_class');
|
||||||
$containerRef = new \ReflectionClass($containerClass);
|
$containerRef = new \ReflectionClass($containerClass);
|
||||||
$containerFile = dirname(dirname($containerRef->getFileName())).'/'.$containerClass.'.php';
|
$containerFile = \dirname(\dirname($containerRef->getFileName())).'/'.$containerClass.'.php';
|
||||||
$containerMetaFile = $containerFile.'.meta';
|
$containerMetaFile = $containerFile.'.meta';
|
||||||
$kernelRef = new \ReflectionObject($this->kernel);
|
$kernelRef = new \ReflectionObject($this->kernel);
|
||||||
$kernelFile = $kernelRef->getFileName();
|
$kernelFile = $kernelRef->getFileName();
|
||||||
|
@ -45,8 +45,8 @@ class CachePoolPrunerPassTest extends TestCase
|
|||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
|
|
||||||
$definitionsBefore = count($container->getDefinitions());
|
$definitionsBefore = \count($container->getDefinitions());
|
||||||
$aliasesBefore = count($container->getAliases());
|
$aliasesBefore = \count($container->getAliases());
|
||||||
|
|
||||||
$pass = new CachePoolPrunerPass();
|
$pass = new CachePoolPrunerPass();
|
||||||
$pass->process($container);
|
$pass->process($container);
|
||||||
|
@ -51,8 +51,8 @@ class LoggingTranslatorPassTest extends TestCase
|
|||||||
$container->register('identity_translator');
|
$container->register('identity_translator');
|
||||||
$container->setAlias('translator', 'identity_translator');
|
$container->setAlias('translator', 'identity_translator');
|
||||||
|
|
||||||
$definitionsBefore = count($container->getDefinitions());
|
$definitionsBefore = \count($container->getDefinitions());
|
||||||
$aliasesBefore = count($container->getAliases());
|
$aliasesBefore = \count($container->getAliases());
|
||||||
|
|
||||||
$pass = new LoggingTranslatorPass();
|
$pass = new LoggingTranslatorPass();
|
||||||
$pass->process($container);
|
$pass->process($container);
|
||||||
@ -68,8 +68,8 @@ class LoggingTranslatorPassTest extends TestCase
|
|||||||
$container->register('monolog.logger');
|
$container->register('monolog.logger');
|
||||||
$container->setAlias('logger', 'monolog.logger');
|
$container->setAlias('logger', 'monolog.logger');
|
||||||
|
|
||||||
$definitionsBefore = count($container->getDefinitions());
|
$definitionsBefore = \count($container->getDefinitions());
|
||||||
$aliasesBefore = count($container->getAliases());
|
$aliasesBefore = \count($container->getAliases());
|
||||||
|
|
||||||
$pass = new LoggingTranslatorPass();
|
$pass = new LoggingTranslatorPass();
|
||||||
$pass->process($container);
|
$pass->process($container);
|
||||||
|
@ -18,7 +18,6 @@ use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
|||||||
use Symfony\Component\Config\Definition\Processor;
|
use Symfony\Component\Config\Definition\Processor;
|
||||||
use Symfony\Component\Lock\Store\SemaphoreStore;
|
use Symfony\Component\Lock\Store\SemaphoreStore;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Serializer\Serializer;
|
|
||||||
|
|
||||||
class ConfigurationTest extends TestCase
|
class ConfigurationTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
|
|
||||||
$this->assertTrue($container->hasDefinition('workflow.registry'), 'Workflow registry is registered as a service');
|
$this->assertTrue($container->hasDefinition('workflow.registry'), 'Workflow registry is registered as a service');
|
||||||
$registryDefinition = $container->getDefinition('workflow.registry');
|
$registryDefinition = $container->getDefinition('workflow.registry');
|
||||||
$this->assertGreaterThan(0, count($registryDefinition->getMethodCalls()));
|
$this->assertGreaterThan(0, \count($registryDefinition->getMethodCalls()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -657,19 +657,19 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$files = array_map('realpath', $options['resource_files']['en']);
|
$files = array_map('realpath', $options['resource_files']['en']);
|
||||||
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
|
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
strtr(dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||||
$files,
|
$files,
|
||||||
'->registerTranslatorConfiguration() finds Validator translation resources'
|
'->registerTranslatorConfiguration() finds Validator translation resources'
|
||||||
);
|
);
|
||||||
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
|
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
strtr(dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||||
$files,
|
$files,
|
||||||
'->registerTranslatorConfiguration() finds Form translation resources'
|
'->registerTranslatorConfiguration() finds Form translation resources'
|
||||||
);
|
);
|
||||||
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
|
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
strtr(dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
|
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||||
$files,
|
$files,
|
||||||
'->registerTranslatorConfiguration() finds Security translation resources'
|
'->registerTranslatorConfiguration() finds Security translation resources'
|
||||||
);
|
);
|
||||||
@ -727,7 +727,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
|
|
||||||
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
|
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
|
||||||
$xmlMappings = array(
|
$xmlMappings = array(
|
||||||
dirname($ref->getFileName()).'/Resources/config/validation.xml',
|
\dirname($ref->getFileName()).'/Resources/config/validation.xml',
|
||||||
strtr($projectDir.'/config/validator/foo.xml', '/', DIRECTORY_SEPARATOR),
|
strtr($projectDir.'/config/validator/foo.xml', '/', DIRECTORY_SEPARATOR),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1244,7 +1244,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
|
|
||||||
protected function createContainerFromFile($file, $data = array(), $resetCompilerPasses = true, $compile = true)
|
protected function createContainerFromFile($file, $data = array(), $resetCompilerPasses = true, $compile = true)
|
||||||
{
|
{
|
||||||
$cacheKey = md5(get_class($this).$file.serialize($data));
|
$cacheKey = md5(\get_class($this).$file.serialize($data));
|
||||||
if ($compile && isset(self::$containerCache[$cacheKey])) {
|
if ($compile && isset(self::$containerCache[$cacheKey])) {
|
||||||
return self::$containerCache[$cacheKey];
|
return self::$containerCache[$cacheKey];
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class AnnotatedController
|
|||||||
*/
|
*/
|
||||||
public function requestDefaultNullAction(Request $request = null)
|
public function requestDefaultNullAction(Request $request = null)
|
||||||
{
|
{
|
||||||
return new Response($request ? get_class($request) : null);
|
return new Response($request ? \get_class($request) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,6 +68,6 @@ class WebTestCase extends BaseWebTestCase
|
|||||||
|
|
||||||
protected static function getVarDir()
|
protected static function getVarDir()
|
||||||
{
|
{
|
||||||
return 'FB'.substr(strrchr(get_called_class(), '\\'), 1);
|
return 'FB'.substr(strrchr(\get_called_class(), '\\'), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
|
|||||||
// should be moved to the Form component once absolute file paths are supported
|
// should be moved to the Form component once absolute file paths are supported
|
||||||
// by the default name parser in the Templating component
|
// by the default name parser in the Templating component
|
||||||
$reflClass = new \ReflectionClass('Symfony\Bundle\FrameworkBundle\FrameworkBundle');
|
$reflClass = new \ReflectionClass('Symfony\Bundle\FrameworkBundle\FrameworkBundle');
|
||||||
$root = realpath(dirname($reflClass->getFileName()).'/Resources/views');
|
$root = realpath(\dirname($reflClass->getFileName()).'/Resources/views');
|
||||||
$rootTheme = realpath(__DIR__.'/Resources');
|
$rootTheme = realpath(__DIR__.'/Resources');
|
||||||
$templateNameParser = new StubTemplateNameParser($root, $rootTheme);
|
$templateNameParser = new StubTemplateNameParser($root, $rootTheme);
|
||||||
$loader = new FilesystemLoader(array());
|
$loader = new FilesystemLoader(array());
|
||||||
|
@ -56,7 +56,7 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
|
|||||||
// should be moved to the Form component once absolute file paths are supported
|
// should be moved to the Form component once absolute file paths are supported
|
||||||
// by the default name parser in the Templating component
|
// by the default name parser in the Templating component
|
||||||
$reflClass = new \ReflectionClass('Symfony\Bundle\FrameworkBundle\FrameworkBundle');
|
$reflClass = new \ReflectionClass('Symfony\Bundle\FrameworkBundle\FrameworkBundle');
|
||||||
$root = realpath(dirname($reflClass->getFileName()).'/Resources/views');
|
$root = realpath(\dirname($reflClass->getFileName()).'/Resources/views');
|
||||||
$rootTheme = realpath(__DIR__.'/Resources');
|
$rootTheme = realpath(__DIR__.'/Resources');
|
||||||
$templateNameParser = new StubTemplateNameParser($root, $rootTheme);
|
$templateNameParser = new StubTemplateNameParser($root, $rootTheme);
|
||||||
$loader = new FilesystemLoader(array());
|
$loader = new FilesystemLoader(array());
|
||||||
|
@ -27,7 +27,7 @@ class TemplateNameParserTest extends TestCase
|
|||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getBundle')
|
->method('getBundle')
|
||||||
->will($this->returnCallback(function ($bundle) {
|
->will($this->returnCallback(function ($bundle) {
|
||||||
if (in_array($bundle, array('SensioFooBundle', 'SensioCmsFooBundle', 'FooBundle'))) {
|
if (\in_array($bundle, array('SensioFooBundle', 'SensioCmsFooBundle', 'FooBundle'))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ EOF
|
|||||||
$encodedPassword = $encoder->encodePassword($password, $salt);
|
$encodedPassword = $encoder->encodePassword($password, $salt);
|
||||||
|
|
||||||
$rows = array(
|
$rows = array(
|
||||||
array('Encoder used', get_class($encoder)),
|
array('Encoder used', \get_class($encoder)),
|
||||||
array('Encoded password', $encodedPassword),
|
array('Encoded password', $encodedPassword),
|
||||||
);
|
);
|
||||||
if (!$emptySalt) {
|
if (!$emptySalt) {
|
||||||
@ -156,7 +156,7 @@ EOF
|
|||||||
$io->table(array('Key', 'Value'), $rows);
|
$io->table(array('Key', 'Value'), $rows);
|
||||||
|
|
||||||
if (!$emptySalt) {
|
if (!$emptySalt) {
|
||||||
$errorIo->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars', strlen($salt)));
|
$errorIo->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars', \strlen($salt)));
|
||||||
} elseif ($saltlessWithoutEmptySalt) {
|
} elseif ($saltlessWithoutEmptySalt) {
|
||||||
$errorIo->note('Self-salting encoder used: the encoder generated its own built-in salt.');
|
$errorIo->note('Self-salting encoder used: the encoder generated its own built-in salt.');
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ EOF
|
|||||||
throw new RuntimeException('There are no configured encoders for the "security" extension.');
|
throw new RuntimeException('There are no configured encoders for the "security" extension.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$input->isInteractive() || 1 === count($this->userClasses)) {
|
if (!$input->isInteractive() || 1 === \count($this->userClasses)) {
|
||||||
return reset($this->userClasses);
|
return reset($this->userClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
|
|||||||
if (null !== $this->roleHierarchy) {
|
if (null !== $this->roleHierarchy) {
|
||||||
$allRoles = $this->roleHierarchy->getReachableRoles($assignedRoles);
|
$allRoles = $this->roleHierarchy->getReachableRoles($assignedRoles);
|
||||||
foreach ($allRoles as $role) {
|
foreach ($allRoles as $role) {
|
||||||
if (!in_array($role, $assignedRoles, true)) {
|
if (!\in_array($role, $assignedRoles, true)) {
|
||||||
$inheritedRoles[] = $role;
|
$inheritedRoles[] = $role;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
|
|||||||
'impersonator_user' => $impersonatorUser,
|
'impersonator_user' => $impersonatorUser,
|
||||||
'impersonation_exit_path' => null,
|
'impersonation_exit_path' => null,
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'token_class' => $this->hasVarDumper ? new ClassStub(get_class($token)) : get_class($token),
|
'token_class' => $this->hasVarDumper ? new ClassStub(\get_class($token)) : \get_class($token),
|
||||||
'logout_url' => $logoutUrl,
|
'logout_url' => $logoutUrl,
|
||||||
'user' => $token->getUsername(),
|
'user' => $token->getUsername(),
|
||||||
'roles' => array_map(function (Role $role) { return $role->getRole(); }, $assignedRoles),
|
'roles' => array_map(function (Role $role) { return $role->getRole(); }, $assignedRoles),
|
||||||
@ -140,7 +140,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
|
|||||||
$this->data['voter_strategy'] = $this->accessDecisionManager->getStrategy();
|
$this->data['voter_strategy'] = $this->accessDecisionManager->getStrategy();
|
||||||
|
|
||||||
foreach ($this->accessDecisionManager->getVoters() as $voter) {
|
foreach ($this->accessDecisionManager->getVoters() as $voter) {
|
||||||
$this->data['voters'][] = $this->hasVarDumper ? new ClassStub(get_class($voter)) : get_class($voter);
|
$this->data['voters'][] = $this->hasVarDumper ? new ClassStub(\get_class($voter)) : \get_class($voter);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->data['access_decision_log'] = array();
|
$this->data['access_decision_log'] = array();
|
||||||
|
@ -53,7 +53,7 @@ final class WrappedListener implements ListenerInterface
|
|||||||
*/
|
*/
|
||||||
public function __call($method, $arguments)
|
public function __call($method, $arguments)
|
||||||
{
|
{
|
||||||
return call_user_func_array(array($this->listener, $method), $arguments);
|
return \call_user_func_array(array($this->listener, $method), $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWrappedListener(): ListenerInterface
|
public function getWrappedListener(): ListenerInterface
|
||||||
@ -64,7 +64,7 @@ final class WrappedListener implements ListenerInterface
|
|||||||
public function getInfo(): array
|
public function getInfo(): array
|
||||||
{
|
{
|
||||||
if (null === $this->stub) {
|
if (null === $this->stub) {
|
||||||
$this->stub = self::$hasVarDumper ? new ClassStub(get_class($this->listener)) : get_class($this->listener);
|
$this->stub = self::$hasVarDumper ? new ClassStub(\get_class($this->listener)) : \get_class($this->listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
@ -112,7 +112,7 @@ class MainConfiguration implements ConfigurationInterface
|
|||||||
->performNoDeepMerging()
|
->performNoDeepMerging()
|
||||||
->beforeNormalization()->ifString()->then(function ($v) { return array('value' => $v); })->end()
|
->beforeNormalization()->ifString()->then(function ($v) { return array('value' => $v); })->end()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return is_array($v) && isset($v['value']); })
|
->ifTrue(function ($v) { return \is_array($v) && isset($v['value']); })
|
||||||
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
|
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
|
||||||
->end()
|
->end()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
@ -218,7 +218,7 @@ class MainConfiguration implements ConfigurationInterface
|
|||||||
->children()
|
->children()
|
||||||
->arrayNode('delete_cookies')
|
->arrayNode('delete_cookies')
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifTrue(function ($v) { return is_array($v) && is_int(key($v)); })
|
->ifTrue(function ($v) { return \is_array($v) && \is_int(key($v)); })
|
||||||
->then(function ($v) { return array_map(function ($v) { return array('name' => $v); }, $v); })
|
->then(function ($v) { return array_map(function ($v) { return array('name' => $v); }, $v); })
|
||||||
->end()
|
->end()
|
||||||
->useAttributeAsKey('name')
|
->useAttributeAsKey('name')
|
||||||
@ -346,11 +346,11 @@ class MainConfiguration implements ConfigurationInterface
|
|||||||
|
|
||||||
$providerNodeBuilder
|
$providerNodeBuilder
|
||||||
->validate()
|
->validate()
|
||||||
->ifTrue(function ($v) { return count($v) > 1; })
|
->ifTrue(function ($v) { return \count($v) > 1; })
|
||||||
->thenInvalid('You cannot set multiple provider types for the same provider')
|
->thenInvalid('You cannot set multiple provider types for the same provider')
|
||||||
->end()
|
->end()
|
||||||
->validate()
|
->validate()
|
||||||
->ifTrue(function ($v) { return 0 === count($v); })
|
->ifTrue(function ($v) { return 0 === \count($v); })
|
||||||
->thenInvalid('You must set a provider definition for the provider.')
|
->thenInvalid('You must set a provider definition for the provider.')
|
||||||
->end()
|
->end()
|
||||||
;
|
;
|
||||||
|
@ -81,7 +81,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
|
|||||||
;
|
;
|
||||||
|
|
||||||
foreach (array_merge($this->options, $this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) {
|
foreach (array_merge($this->options, $this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) {
|
||||||
if (is_bool($default)) {
|
if (\is_bool($default)) {
|
||||||
$builder->booleanNode($name)->defaultValue($default);
|
$builder->booleanNode($name)->defaultValue($default);
|
||||||
} else {
|
} else {
|
||||||
$builder->scalarNode($name)->defaultValue($default);
|
$builder->scalarNode($name)->defaultValue($default);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user