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

Skip to content

Commit 3b420f9

Browse files
bug #21802 [3.2] Fix issues reported by static analyse (romainneutron)
This PR was merged into the 3.2 branch. Discussion ---------- [3.2] Fix issues reported by static analyse | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Follow-up #21801 Commits ------- a9ccacc [3.2] Fix issues reported by static analyse
2 parents bbb17df + a9ccacc commit 3b420f9

File tree

11 files changed

+14
-22
lines changed

11 files changed

+14
-22
lines changed

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function resetService($name)
4545
$manager = $this->container->get($name);
4646

4747
if (!$manager instanceof LazyLoadingInterface) {
48-
@trigger_error(sprintf('Resetting a non-lazy manager service is deprecated since Symfony 3.2 and will throw an exception in version 4.0. Set the "%s" service as lazy and require "symfony/proxy-manager-bridge" in your composer.json file instead.', $name));
48+
@trigger_error(sprintf('Resetting a non-lazy manager service is deprecated since Symfony 3.2 and will throw an exception in version 4.0. Set the "%s" service as lazy and require "symfony/proxy-manager-bridge" in your composer.json file instead.', $name), E_USER_DEPRECATED);
4949

5050
$this->container->set($name, null);
5151

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplatePathsCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function __construct(TemplateFinderInterface $finder, TemplateLocator $lo
3535
{
3636
$this->finder = $finder;
3737
$this->locator = $locator;
38-
$this->filesystem = new Filesystem();
3938
}
4039

4140
/**
@@ -45,10 +44,11 @@ public function __construct(TemplateFinderInterface $finder, TemplateLocator $lo
4544
*/
4645
public function warmUp($cacheDir)
4746
{
47+
$filesystem = new Filesystem();
4848
$templates = array();
4949

5050
foreach ($this->finder->findAllTemplates() as $template) {
51-
$templates[$template->getLogicalName()] = rtrim($this->filesystem->makePathRelative($this->locator->locate($template), $cacheDir), '/');
51+
$templates[$template->getLogicalName()] = rtrim($filesystem->makePathRelative($this->locator->locate($template), $cacheDir), '/');
5252
}
5353

5454
$templates = str_replace("' => '", "' => __DIR__.'/", var_export($templates, true));

src/Symfony/Component/Cache/Adapter/ApcuAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($namespace = '', $defaultLifetime = 0, $version = nu
3838
CacheItem::validateKey($version);
3939

4040
if (!apcu_exists($version.'@'.$namespace)) {
41-
$this->clear($namespace);
41+
$this->doClear($namespace);
4242
apcu_add($version.'@'.$namespace, null);
4343
}
4444
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BE
7878
if (__CLASS__ !== get_class($this)) {
7979
$r = new \ReflectionMethod($this, __FUNCTION__);
8080
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
81-
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
81+
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED);
8282
}
8383
}
8484

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O
102102
if (__CLASS__ !== get_class($this)) {
103103
$r = new \ReflectionMethod($this, __FUNCTION__);
104104
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
105-
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
105+
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED);
106106
}
107107
}
108108

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig:
316316
if (__CLASS__ !== get_class($this)) {
317317
$r = new \ReflectionMethod($this, __FUNCTION__);
318318
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
319-
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
319+
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED);
320320
}
321321
}
322322

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private function parseDefinition(\DOMElement $service, $file)
182182
if (isset($factoryService[0])) {
183183
$class = $this->parseDefinition($factoryService[0], $file);
184184
} elseif ($childService = $factory->getAttribute('service')) {
185-
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
185+
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
186186
} else {
187187
$class = $factory->getAttribute('class');
188188
}
@@ -201,7 +201,7 @@ private function parseDefinition(\DOMElement $service, $file)
201201
if (isset($configuratorService[0])) {
202202
$class = $this->parseDefinition($configuratorService[0], $file);
203203
} elseif ($childService = $configurator->getAttribute('service')) {
204-
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
204+
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
205205
} else {
206206
$class = $configurator->getAttribute('class');
207207
}
@@ -374,13 +374,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $lowercase = true)
374374
$invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
375375
}
376376

377-
if ($strict = $arg->getAttribute('strict')) {
378-
$strict = XmlUtils::phpize($strict);
379-
} else {
380-
$strict = true;
381-
}
382-
383-
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior, $strict);
377+
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
384378
break;
385379
case 'expression':
386380
$arguments[$key] = new Expression($arg->nodeValue);

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,10 @@ private function resolveServices($value)
468468

469469
if ('=' === substr($value, -1)) {
470470
$value = substr($value, 0, -1);
471-
$strict = false;
472-
} else {
473-
$strict = true;
474471
}
475472

476473
if (null !== $invalidBehavior) {
477-
$value = new Reference($value, $invalidBehavior, $strict);
474+
$value = new Reference($value, $invalidBehavior);
478475
}
479476
}
480477

src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function cloneVar($var)
102102
*/
103103
protected function varToString($var)
104104
{
105-
@trigger_error(sprintf('The %() method is deprecated since version 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED);
105+
@trigger_error(sprintf('The %s() method is deprecated since version 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED);
106106

107107
if (null === $this->valueExporter) {
108108
$this->valueExporter = new ValueExporter();

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
296296
if (__CLASS__ !== get_class($this)) {
297297
$r = new \ReflectionMethod($this, __FUNCTION__);
298298
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
299-
@trigger_error(sprintf('Method %s() will have a 6th `$format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
299+
@trigger_error(sprintf('Method %s::%s() will have a 6th `$format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
300300
}
301301
}
302302

src/Symfony/Component/Translation/Dumper/FileDumper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Translation\MessageCatalogue;
1515
use Symfony\Component\Translation\Exception\InvalidArgumentException;
16+
use Symfony\Component\Translation\Exception\RuntimeException;
1617

1718
/**
1819
* FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s).

0 commit comments

Comments
 (0)