8000 [master] Fix issues reported by static analyse · symfony/symfony@671694d · GitHub
[go: up one dir, main page]

Skip to content

Commit 671694d

Browse files
committed
[master] Fix issues reported by static analyse
1 parent 9e4f82e commit 671694d

File tree

13 files changed

+29
-29
lines changed

13 files changed

+29
-29
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php

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

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Reference;

src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff l 8000 ine numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bundle\TwigBundle;
1313

14-
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use the Twig_ContainerRuntimeLoader class instead.'), ContainerAwareRuntimeLoader::class);
14+
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use the Twig_ContainerRuntimeLoader class instead.', ContainerAwareRuntimeLoader::class), E_USER_DEPRECATED);
1515

1616
use Psr\Log\LoggerInterface;
1717
use Symfony\Component\DependencyInjection\ContainerInterface;

src/Symfony/Component/Cache/Simple/Psr6Cache.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Psr\Cache\CacheException as Psr6CacheException;
1616
use Psr\SimpleCache\CacheInterface;
1717
use Psr\SimpleCache\CacheException as SimpleCacheException;
18+
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1819
use Symfony\Component\Cache\CacheItem;
1920
use Symfony\Component\Cache\Exception\InvalidArgumentException;
2021

@@ -30,22 +31,20 @@ public function __construct(CacheItemPoolInterface $pool)
3031
{
3132
$this->pool = $pool;
3233

33-
if ($pool instanceof Adapter\AdapterInterface) {
34+
if ($pool instanceof AbstractAdapter) {
3435
$this->createCacheItem = \Closure::bind(
3536
function ($key, $value, $allowInt = false) {
3637
if ($allowInt && is_int($key)) {
3738
$key = (string) $key;
3839
} else {
3940
CacheItem::validateKey($key);
4041
}
41-
$item = new CacheItem();
42-
$item->key = $key;
43-
$item->value = $value;
42+
$f = $this->createCacheItem;
4443

45-
return $item;
44+
return $f($key, $value, false);
4645
},
47-
null,
48-
CacheItem::class
46+
$pool,
47+
AbstractAdapter::class
4948
);
5049
}
5150
}

src/Symfony/Component/Config/Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ protected function glob($resource, $recursive, &$prefix = null, $ignoreErrors =
144144
}
145145

146146
if (!class_exists(Finder::class)) {
147-
throw new LogicException(sprintf('Extended glob pattern "%s" cannot be used as the Finder component is not installed.', $resource));
147+
throw new \LogicException(sprintf('Extended glob pattern "%s" cannot be used as the Finder component is not installed.', $resource));
148148
}
149149

150150
$finder = new Finder();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function strlen($string)
7070
public static function substr($string, $from, $length = null)
7171
{
7272
if (false === $encoding = mb_detect_encoding($string, null, true)) {
73-
return substr($string);
73+
return substr($string, $from, $length);
7474
}
7575

7676
return mb_substr($string, $from, $length, $encoding);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function processValue($value, $isRoot = false)
113113
if ($constructor = $reflectionClass->getConstructor()) {
114114
array_unshift($methodCalls, array($constructor->name, $value->getArguments()));
115115
} elseif ($value->getArguments()) {
116-
throw new RuntimeException(sprintf('Cannot autowire service "%s": class %s has no constructor but arguments are defined.', $this->currentId, $reflectionClass->name, $method));
116+
throw new RuntimeException(sprintf('Cannot autowire service "%s": class %s has no constructor but arguments are defined.', $this->currentId, $reflectionClass->name));
117117
}
118118

119119
$methodCalls = $this->autowireCalls($reflectionClass, $methodCalls, $autowiredMethods);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $re
9494
if (__CLASS__ !== get_class($this)) {
9595
$r = new \ReflectionMethod($this, __FUNCTION__);
9696
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
97-
@trigger_error(sprintf('Method %s() will have a 6th `$lazy = false` argument in version 4.0. Not defining it is deprecated since 3.3.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
97+
@trigger_error(sprintf('Method %s() will have a 6th `$lazy = false` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED);
9898
}
9999
}
100100
$lazy = false;

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
117117
*/
118118
private $vendors;
119119

120+
/**
121+
* @var \ReflectionClass[] a list of class reflectors
122+
*/
123+
private $classReflectors;
124+
120125
/**
121126
* Sets the track resources flag.
122127
*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Loader;
1313

1414
use Symfony\Component\DependencyInjection\Alias;
15+
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
1516
use Symfony\Component\DependencyInjection\Argument\ClosureProxyArgument;
1617
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1718
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_private_frozen.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<?php
22

3+
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
34
use Symfony\Component\DependencyInjection\ContainerInterface;
45
use Symfony\Component\DependencyInjection\Container;
56
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
67
use Symfony\Component\DependencyInjection\Exception\LogicException;
78
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
89
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
10+
use Symfony\Component\DependencyInjection\ServiceLocator;
911

1012
/**
1113
* ProjectServiceContainer.
1214
*
1315
* This class has been auto-generated
1416
* by the Symfony Dependency Injection Component.
17+
*
18+
* @final since Symfony 3.3
1519
*/
1620
class ProjectServiceContainer extends Container
1721
{

0 commit comments

Comments
 (0)
0