Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b88728a

Browse files
Merge branch '4.1' into 4.2
* 4.1: Fix typos in doc blocks [Debug] ignore underscore vs backslash namespaces in DebugClassLoader [TwigBridge][Form] Prevent multiple rendering of form collection prototypes [FrameworkBundle] fix describing routes with no controllers [DI] move RegisterServiceSubscribersPass before DecoratorServicePass Update ValidationListener.php [Yaml] ensures that the mb_internal_encoding is reset to its initial value [WebLink] Fixed documentation link [Security] getTargetPath of TargetPathTrait must return string or null [Hackday][Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument Optimize perf by replacing call_user_func with dynamic vars [Routing] fix dumping same-path routes with placeholders [Security] defer log message in guard authenticator [Validator] Added IBAN format for Vatican City State merge conflicts filter out invalid Intl values filter out invalid language values [Validator] Fixed grouped composite constraints [Form] Filter arrays out of scalar form types Fix HeaderBag::get phpdoc
2 parents 0b99a8e + 547bf26 commit b88728a

File tree

88 files changed

+468
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+468
-186
lines changed

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function configureOptions(OptionsResolver $resolver)
213213
// for equal query builders
214214
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
215215
if (\is_callable($queryBuilder)) {
216-
$queryBuilder = \call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
216+
$queryBuilder = $queryBuilder($options['em']->getRepository($options['class']));
217217
}
218218

219219
return $queryBuilder;

src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function configureOptions(OptionsResolver $resolver)
2929
// for equal query builders
3030
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
3131
if (\is_callable($queryBuilder)) {
32-
$queryBuilder = \call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
32+
$queryBuilder = $queryBuilder($options['em']->getRepository($options['class']));
3333

3434
if (null !== $queryBuilder && !$queryBuilder instanceof QueryBuilder) {
3535
throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');

src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function formatRecord(array $record)
102102
{
103103
if ($this->processors) {
104104
foreach ($this->processors as $processor) {
105-
$record = \call_user_func($processor, $record);
105+
$record = $processor($record);
106106
}
107107
}
108108

src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function instantiateProxy(ContainerInterface $container, Definition $defi
4343
return $this->factory->createProxy(
4444
$this->factory->getGenerator()->getProxifiedClass($definition),
4545
function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($realInstantiator) {
46-
$wrappedInstance = \call_user_func($realInstantiator);
46+
$wrappedInstance = $realInstantiator();
4747

4848
$proxy->setProxyInitializer(null);
4949

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
{%- endblock form_widget_compound -%}
2929

3030
{%- block collection_widget -%}
31-
{% if prototype is defined %}
31+
{% if prototype is defined and not prototype.rendered %}
3232
{%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%}
3333
{% endif %}
3434
{{- block('form_widget') -}}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
5757

5858
if ($showControllers) {
5959
$controller = $route->getDefault('_controller');
60-
$row[] = $this->formatCallable($controller);
60+
$row[] = $controller ? $this->formatCallable($controller) : '';
6161
}
6262

6363
$tableRows[] = $row;

src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(UrlGeneratorInterface $router = null, int $httpPort
5050
* @param string $route The route name to redirect to
5151
* @param bool $permanent Whether the redirection is permanent
5252
* @param bool|array $ignoreAttributes Whether to ignore attributes or an array of attributes to ignore
53-
* @param bool $keepRequestMethod Wheter redirect action should keep HTTP request method
53+
* @param bool $keepRequestMethod Whether redirect action should keep HTTP request method
5454
*
5555
* @throws HttpException In case the route name is empty
5656
*/
@@ -94,7 +94,7 @@ public function redirectAction(Request $request, string $route, bool $permanent
9494
* @param string|null $scheme The URL scheme (null to keep the current one)
9595
* @param int|null $httpPort The HTTP port (null to keep the current one for the same scheme or the default configured port)
9696
* @param int|null $httpsPort The HTTPS port (null to keep the current one for the same scheme or the default configured port)
97-
* @param bool $keepRequestMethod Wheter redirect action should keep HTTP request method
97+
* @param bool $keepRequestMethod Whether redirect action should keep HTTP request method
9898
*
9999
* @throws HttpException In case the path is empty
100100
*/

src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ class PhpArrayAdapterWrapper extends PhpArrayAdapter
146146

147147
public function save(CacheItemInterface $item)
148148
{
149-
\call_user_func(\Closure::bind(function () use ($item) {
149+
(\Closure::bind(function () use ($item) {
150150
$key = $item->getKey();
151151
$this->keys[$key] = $id = \count($this->values);
152152
$this->data[$key] = $this->values[$id] = $item->get();
153153
$this->warmUp($this->data);
154154
list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
155-
}, $this, PhpArrayAdapter::class));
155+
}, $this, PhpArrayAdapter::class))();
156156

157157
return true;
158158
}

src/Symfony/Component/Cache/Tests/CacheItemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public function testTag()
6262
$this->assertSame($item, $item->tag('foo'));
6363
$this->assertSame($item, $item->tag(array('bar', 'baz')));
6464

65-
\call_user_func(\Closure::bind(function () use ($item) {
65+
(\Closure::bind(function () use ($item) {
6666
$this->assertSame(array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'), $item->newMetadata[CacheItem::METADATA_TAGS]);
67-
}, $this, CacheItem::class));
67+
}, $this, CacheItem::class))();
6868
}
6969

7070
/**

src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ class PhpArrayCacheWrapper extends PhpArrayCache
134134

135135
public function set($key, $value, $ttl = null)
136136
{
137-
\call_user_func(\Closure::bind(function () use ($key, $value) {
137+
(\Closure::bind(function () use ($key, $value) {
138138
$this->data[$key] = $value;
139139
$this->warmUp($this->data);
140140
list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
141-
}, $this, PhpArrayCache::class));
141+
}, $this, PhpArrayCache::class))();
142142

143143
return true;
144144
}
@@ -148,13 +148,13 @@ public function setMultiple($values, $ttl = null)
148148
if (!\is_array($values) && !$values instanceof \Traversable) {
149149
return parent::setMultiple($values, $ttl);
150150
}
151-
\call_user_func(\Closure::bind(function () use ($values) {
151+
(\Closure::bind(function () use ($values) {
152152
foreach ($values as $key => $value) {
153153
$this->data[$key] = $value;
154154
}
155155
$this->warmUp($this->data);
156156
list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
157-
}, $this, PhpArrayCache::class));
157+
}, $this, PhpArrayCache::class))();
158158

159159
return true;
160160
}

src/Symfony/Component/Config/ConfigCacheFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function cache($file, $callback)
4343

4444
$cache = new ConfigCache($file, $this->debug);
4545
if (!$cache->isFresh()) {
46-
\call_user_func($callback, $cache);
46+
$callback($cache);
4747
}
4848

4949
return $cache;

src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ private function generateSignature(\ReflectionClass $class)
155155

156156
if (interface_exists(EventSubscriberInterface::class, false) && $class->isSubclassOf(EventSubscriberInterface::class)) {
157157
yield EventSubscriberInterface::class;
158-
yield print_r(\call_user_func(array($class->name, 'getSubscribedEvents')), true);
158+
yield print_r($class->name::getSubscribedEvents(), true);
159159
}
160160

161161
if (interface_exists(LegacyServiceSubscriberInterface::class, false) && $class->isSubclassOf(LegacyServiceSubscriberInterface::class)) {
162162
yield LegacyServiceSubscriberInterface::class;
163-
yield print_r(\call_user_func(array($class->name, 'getSubscribedServices')), true);
163+
yield print_r(array($class->name, 'getSubscribedServices')(), true);
164164
} elseif (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) {
165165
yield ServiceSubscriberInterface::class;
166-
yield print_r(\call_user_func(array($class->name, 'getSubscribedServices')), true);
166+
yield print_r($class->name::getSubscribedServices(), true);
167167
}
168168
}
169169
}

src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function cache($file, $callback)
4040

4141
$cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers);
4242
if (!$cache->isFresh()) {
43-
\call_user_func($callback, $cache);
43+
$callback($cache);
4444
}
4545

4646
return $cache;

src/Symfony/Component/Config/Util/XmlUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function parse($content, $schemaOrCallable = null)
8080
$e = null;
8181
if (\is_callable($schemaOrCallable)) {
8282
try {
83-
$valid = \call_user_func($schemaOrCallable, $dom, $internalErrors);
83+
$valid = $schemaOrCallable($dom, $internalErrors);
8484
} catch (\Exception $e) {
8585
$valid = false;
8686
}

src/Symfony/Component/Console/Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function run(InputInterface $input, OutputInterface $output)
250250
$input->validate();
251251

252252
if ($this->code) {
253-
$statusCode = \call_user_func($this->code, $input, $output);
253+
$statusCode = ($this->code)($input, $output);
254254
} else {
255255
$statusCode = $this->execute($input, $output);
256256
}

src/Symfony/Component/Console/Helper/ProcessHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function wrapCallback(OutputInterface $output, Process $process, callable
136136
$output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
137137

138138
if (null !== $callback) {
139-
\call_user_func($callback, $type, $buffer);
139+
$callback($type, $buffer);
140140
}
141141
};
142142
}

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ private function buildLine(): string
496496
$regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
497497
$callback = function ($matches) {
498498
if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
499-
$text = \call_user_func($formatter, $this, $this->output);
499+
$text = $formatter($this, $this->output);
500500
} elseif (isset($this->messages[$matches[1]])) {
501501
$text = $this->messages[$matches[1]];
502502
} else {

src/Symfony/Component/Console/Helper/ProgressIndicator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private function display()
196196

197197
$this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
198198
if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
199-
return \call_user_func($formatter, $self);
199+
return $formatter($self);
200200
}
201201

202202
return $matches[0];

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private function validateAttempts(callable $interviewer, OutputInterface $output
381381
}
382382

383383
try {
384-
return \call_user_func($question->getValidator(), $interviewer());
384+
return $question->getValidator()($interviewer());
385385
} catch (RuntimeException $e) {
386386
throw $e;
387387
} catch (\Exception $error) {

src/Symfony/Component/CssSelector/XPath/Translator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function nodeToXPath(NodeInterface $node): XPathExpr
155155
throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
156156
}
157157

158-
return \call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this);
158+
return $this->nodeTranslators[$node->getNodeName()]($node, $this);
159159
}
160160

161161
/**
@@ -167,7 +167,7 @@ public function addCombination(string $combiner, NodeInterface $xpath, NodeInter
167167
throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner));
168168
}
169169

170-
return \call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath));
170+
return $this->combinationTranslators[$combiner]($this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath));
171171
}
172172

173173
/**
@@ -179,7 +179,7 @@ public function addFunction(XPathExpr $xpath, FunctionNode $function): XPathExpr
179179
throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName()));
180180
}
181181

182-
return \call_user_func($this->functionTranslators[$function->getName()], $xpath, $function);
182+
return $this->functionTranslators[$function->getName()]($xpath, $function);
183183
}
184184

185185
/**
@@ -191,7 +191,7 @@ public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr
191191
throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass));
192192
}
193193

194-
return \call_user_func($this->pseudoClassTranslators[$pseudoClass], $xpath);
194+
return $this->pseudoClassTranslators[$pseudoClass]($xpath);
195195
}
196196

197197
/**
@@ -203,7 +203,7 @@ public function addAttributeMatching(XPathExpr $xpath, string $operator, string
203203
throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator));
204204
}
205205

206-
return \call_user_func($this->attributeMatchingTranslators[$operator], $xpath, $attribute, $value);
206+
return $this->attributeMatchingTranslators[$operator]($xpath, $attribute, $value);
207207
}
208208

209209
/**

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function loadClass($class)
151151
require $file;
152152
}
153153
} else {
154-
\call_user_func($this->classLoader, $class);
154+
($this->classLoader)($class);
155155
$file = false;
156156
}
157157
} finally {
@@ -218,7 +218,7 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
218218
$len = 0;
219219
$ns = '';
220220
} else {
221-
$ns = \substr($class, 0, $len);
221+
$ns = \str_replace('_', '\\', \substr($class, 0, $len));
222222
}
223223

224224
// Detect annotations on the class
@@ -249,13 +249,13 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
249249
if (!isset(self::$checkedClasses[$use])) {
250250
$this->checkClass($use);
251251
}
252-
if (isset(self::$deprecated[$use]) && \strncmp($ns, $use, $len)) {
252+
if (isset(self::$deprecated[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) {
253253
$type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait');
254254
$verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
255255

256256
$deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]);
257257
}
258-
if (isset(self::$internal[$use]) && \strncmp($ns, $use, $len)) {
258+
if (isset(self::$internal[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) {
259259
$deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class);
260260
}
261261
}

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public function handleException($exception, array $error = null)
560560
$this->exceptionHandler = null;
561561
try {
562562
if (null !== $exceptionHandler) {
563-
return \call_user_func($exceptionHandler, $exception);
563+
return $exceptionHandler($exception);
564564
}
565565
$handlerException = $handlerException ?: $exception;
566566
} catch (\Throwable $handlerException) {

src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function handle(\Exception $exception)
142142
$this->caughtBuffer = null;
143143

144144
try {
145-
\call_user_func($this->handler, $exception);
145+
($this->handler)($exception);
146146
$this->caughtLength = $caughtLength;
147147
} catch (\Exception $e) {
148148
if (!$caughtLength) {

src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ public function __construct()
5252
new ValidateEnvPlaceholdersPass(),
5353
new ResolveChildDefinitionsPass(),
5454
new ServiceLocatorTagPass(),
55+
new RegisterServiceSubscribersPass(),
5556
new DecoratorServicePass(),
5657
new ResolveParameterPlaceHoldersPass(false),
5758
new ResolveFactoryClassPass(),
5859
new CheckDefinitionValidityPass(),
59-
new RegisterServiceSubscribersPass(),
6060
new ResolveNamedArgumentsPass(),
6161
new AutowireRequiredMethodsPass(),
6262
new ResolveBindingsPass(),

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ private function createService(Definition $definition, array &$inlineServices, $
11621162
throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', \get_class($service)));
11631163
}
11641164

1165-
\call_user_func($callable, $service);
1165+
$callable($service);
11661166
}
11671167

11681168
return $service;

src/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ class RealServiceInstantiator implements InstantiatorInterface
2828
*/
2929
public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator)
3030
{
31-
return \call_user_func($realInstantiator);
31+
return $realInstantiator();
3232
}
3333
}

src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(ContainerBuilder $container)
3535
*/
3636
public function load($resource, $type = null)
3737
{
38-
\call_user_func($resource, $this->container);
38+
$resource($this->container);
3939
}
4040

4141
/**

0 commit comments

Comments
 (0)