[3.2] Fix issues reported by static analyse

This commit is contained in:
Romain Neutron 2017-02-28 15:23:14 +01:00
parent bbb17df480
commit a9ccaccd41
No known key found for this signature in database
GPG Key ID: 201FC7CF9F0CA3ED
11 changed files with 14 additions and 22 deletions

View File

@ -45,7 +45,7 @@ abstract class ManagerRegistry extends AbstractManagerRegistry implements Contai
$manager = $this->container->get($name);
if (!$manager instanceof LazyLoadingInterface) {
@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));
@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);
$this->container->set($name, null);

View File

@ -35,7 +35,6 @@ class TemplatePathsCacheWarmer extends CacheWarmer
{
$this->finder = $finder;
$this->locator = $locator;
$this->filesystem = new Filesystem();
}
/**
@ -45,10 +44,11 @@ class TemplatePathsCacheWarmer extends CacheWarmer
*/
public function warmUp($cacheDir)
{
$filesystem = new Filesystem();
$templates = array();
foreach ($this->finder->findAllTemplates() as $template) {
$templates[$template->getLogicalName()] = rtrim($this->filesystem->makePathRelative($this->locator->locate($template), $cacheDir), '/');
$templates[$template->getLogicalName()] = rtrim($filesystem->makePathRelative($this->locator->locate($template), $cacheDir), '/');
}
$templates = str_replace("' => '", "' => __DIR__.'/", var_export($templates, true));

View File

@ -38,7 +38,7 @@ class ApcuAdapter extends AbstractAdapter
CacheItem::validateKey($version);
if (!apcu_exists($version.'@'.$namespace)) {
$this->clear($namespace);
$this->doClear($namespace);
apcu_add($version.'@'.$namespace, null);
}
}

View File

@ -78,7 +78,7 @@ class Compiler
if (__CLASS__ !== get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
@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);
}
}

View File

@ -102,7 +102,7 @@ class PassConfig
if (__CLASS__ !== get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
@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);
}
}

View File

@ -316,7 +316,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (__CLASS__ !== get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
@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);
}
}

View File

@ -182,7 +182,7 @@ class XmlFileLoader extends FileLoader
if (isset($factoryService[0])) {
$class = $this->parseDefinition($factoryService[0], $file);
} elseif ($childService = $factory->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
} else {
$class = $factory->getAttribute('class');
}
@ -201,7 +201,7 @@ class XmlFileLoader extends FileLoader
if (isset($configuratorService[0])) {
$class = $this->parseDefinition($configuratorService[0], $file);
} elseif ($childService = $configurator->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
} else {
$class = $configurator->getAttribute('class');
}
@ -374,13 +374,7 @@ class XmlFileLoader extends FileLoader
$invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
}
if ($strict = $arg->getAttribute('strict')) {
$strict = XmlUtils::phpize($strict);
} else {
$strict = true;
}
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior, $strict);
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
break;
case 'expression':
$arguments[$key] = new Expression($arg->nodeValue);

View File

@ -468,13 +468,10 @@ class YamlFileLoader extends FileLoader
if ('=' === substr($value, -1)) {
$value = substr($value, 0, -1);
$strict = false;
} else {
$strict = true;
}
if (null !== $invalidBehavior) {
$value = new Reference($value, $invalidBehavior, $strict);
$value = new Reference($value, $invalidBehavior);
}
}

View File

@ -102,7 +102,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
*/
protected function varToString($var)
{
@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);
@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);
if (null === $this->valueExporter) {
$this->valueExporter = new ValueExporter();

View File

@ -296,7 +296,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
if (__CLASS__ !== get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
@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);
}
}

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Exception\InvalidArgumentException;
use Symfony\Component\Translation\Exception\RuntimeException;
/**
* FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s).