8000 More fixes · symfony/symfony@daf1157 · GitHub
[go: up one dir, main page]

Skip to content

Commit daf1157

Browse files
More fixes
1 parent d97ce78 commit daf1157

File tree

25 files changed

+74
-59
lines changed

25 files changed

+74
-59
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
6969
* only do anything if the parameter is present. (But regardless of the
7070
* value of that parameter.
7171
*
72-
* @var string
72+
* @var string|false
7373
*/
7474
protected $enabledParameter;
7575

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private function getLoaderPaths()
135135

136136
$loaderPaths = array();
137137
foreach ($loader->getNamespaces() as $namespace) {
138-
$paths = array_map(function ($path) use ($namespace) {
138+
$paths = array_map(function ($path) {
139139
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
140140
$path = ltrim(substr($path, strlen($this->projectDir)), DIRECTORY_SEPARATOR);
141141
}

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function formatFile($file, $line, $text = null)
196196
* @param string $file An absolute file path
197197
* @param int $line The line number
198198
*
199-
* @return string A link of false
199+
* @return string|false A link or false
200200
*/
201201
public function getFileLink($file, $line)
202202
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private function extractSupportedLoaders(array $loaders)
8080
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
8181
$supportedLoaders[] = $loader;
8282
} elseif ($loader instanceof LoaderChain) {
83-
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getDelegatedLoaders()));
83+
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
8484
}
8585
}
8686

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private function extractSupportedLoaders(array $loaders)
9191
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
9292
$supportedLoaders[] = $loader;
9393
} elseif ($loader instanceof LoaderChain) {
94-
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getDelegatedLoaders()));
94+
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
9595
}
9696
}
9797

src/Symfony/Bundle/FrameworkBundle/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getKernel()
6262
/**
6363
* Gets the profile associated with the current Response.
6464
*
65-
* @return HttpProfile A Profile instance
65+
* @return HttpProfile|false A Profile instance
6666
*/
6767
public function getProfile()
6868
{

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7575
$io = new SymfonyStyle($input, $output);
7676

7777
$kernel = $this->getApplication()->getKernel();
78-
$realCacheDir = isset($realCacheDir) ? $realCacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir');
78+
$realCacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
7979
// the old cache dir name must not be longer than the real one to avoid exceeding
8080
// the maximum length of a directory or file path within it (esp. Windows MAX_PATH)
8181
$oldCacheDir = substr($realCacheDir, 0, -1).('~' === substr($realCacheDir, -1) ? '+' : '~');

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ abstract class Controller implements ContainerAwareInterface
3232
* @param string $name The parameter name
3333
*
3434
* @return mixed
35+
*
36+
* @final
3537
*/
36-
protected function getParameter($name)
38+
protected function getParameter(string $name)
3739
{
3840
return $this->container->getParameter($name);
3941
}

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

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

1212
namespace Symfony\Component\Cache\Adapter;
1313

14+
use Doctrine\DBAL\Connection;
1415
use Symfony\Component\Cache\PruneableInterface;
1516
use Symfony\Component\Cache\Traits\PdoTrait;
1617

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function init($redisClient, $namespace = '', $defaultLifetime = 0)
4848
throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
4949
}
5050
if ($redisClient instanceof \RedisCluster) {
51-
$this->enableversioning();
51+
$this->enableVersioning();
5252
} elseif (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \Predis\Client) {
5353
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, is_object($redisClient) ? get_class($redisClient) : gettype($redisClient)));
5454
}

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ public function write($content, array $metadata = null)
121121
$mode = 0666;
122122
$umask = umask();
123123
$filesystem = new Filesystem();
124-
$filesystem->dumpFile($this->file, $content, null);
124+
$filesystem->dumpFile($this->file, $content);
125125
try {
126126
$filesystem->chmod($this->file, $mode, $umask);
127127
} catch (IOException $e) {
128128
// discard chmod failure (some filesystem may not support it)
129129
}
130130

131131
if (null !== $metadata) {
132-
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
132+
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata));
133133
try {
134134
$filesystem->chmod($this->getMetaFile(), $mode, $umask);
135135
} catch (IOException $e) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static function loadFile($file, $schemaOrCallable = null)
135135
}
136136

137137
/**
138-
* Converts a \DomElement object to a PHP array.
138+
* Converts a \DOMElement object to a PHP array.
139139
*
140140
* The following rules applies during the conversion:
141141
*
@@ -149,7 +149,7 @@ public static function loadFile($file, $schemaOrCallable = null)
149149
*
150150
* * The nested-tags are converted to keys (<foo><foo>bar</foo></foo>)
151151
*
152-
* @param \DomElement $element A \DomElement instance
152+
* @param \DOMElement $element A \DOMElement instance
153153
* @param bool $checkPrefix Check prefix in an element or an attribute name
154154
*
155155
* @return array A PHP array

src/Symfony/Component/Console/Exception/CommandNotFoundException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
2121
private $alternatives;
2222

2323
/**
24-
* @param string $message Exception message to throw
25-
* @param array $alternatives List of similar defined names
26-
* @param int $code Exception code
27-
* @param Exception $previous previous exception used for the exception chaining
24+
* @param string $message Exception message to throw
25+
* @param array $alternatives List of similar defined names
26+
* @param int $code Exception code
27+
* @param \Exception $previous previous exception used for the exception chaining
2828
*/
2929
public function __construct(string $message, array $alternatives = array(), int $code = 0, \Exception $previous = null)
3030
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ private function getRowColumns(array $row): array
550550
return $columns;
551551
}
552552

553-
private function calculateColumnsWidth($rows)
553+
private function calculateColumnsWidth(array $rows)
554554
{
555555
for ($column = 0; $column < $this->numberOfColumns; ++$column) {
556556
$lengths = array();

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ private function addServiceInstance(string $id, Definition $definition, string $
437437
return $code;
438438
}
439439

440-
private function isSimpleInstance(string $id, Definition $definition): bool
440+
private function isSimpleInstance(string $id, Definition $definition, $inlinedDefinitions): bool
441441
{
442-
foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) {
442+
foreach (array_merge(array($definition), $inlinedDefinitions) as $sDefinition) {
443443
if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) {
444444
continue;
445445
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
229229
}
230230
if ('bind' === $k) {
231231
if ($defaults['bind']) {
232-
throw new InvalidArgumentException(sprintf('Bound values on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file.', $k, $service->getAttribute('id')));
232+
throw new InvalidArgumentException(sprintf('Bound values on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file.', $service->getAttribute('id')));
233233
}
234234

235235
continue;
@@ -687,7 +687,7 @@ private function loadFromExtensions(\DOMDocument $xml)
687687
}
688688

689689
/**
690-
* Converts a \DomElement object to a PHP array.
690+
* Converts a \DOMElement object to a PHP array.
691691
*
692692
* The following rules applies during the conversion:
693693
*
@@ -701,7 +701,7 @@ private function loadFromExtensions(\DOMDocument $xml)
701701
*
702702
* * The nested-tags are converted to keys (<foo><foo>bar</foo></foo>)
703703
*
704-
* @param \DomElement $element A \DomElement instance
704+
* @param \DOMElement $element A \DOMElement instance
705705
*
706706
* @return array A PHP array
707707
*/

src/Symfony/Component/Form/Extension/Core/Type/DateType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function getBlockPrefix()
285285
private function formatTimestamps(\IntlDateFormatter $formatter, $regex, array $timestamps)
286286
{
287287
$pattern = $formatter->getPattern();
288-
$timezone = $formatter->getTimezoneId();
288+
$timezone = $formatter->getTimeZoneId();
289289
$formattedTimestamps = array();
290290

291291
$formatter->setTimeZone('UTC');

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ private function getContainerCompilerLogs()
160160
private function sanitizeLogs($logs)
161161
{
162162
$sanitizedLogs = array();
163+
$silencedLogs = array();
163164

164165
foreach ($logs as $log) {
165166
if (!$this->isSilencedOrDeprecationErrorLog($log)) {

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function locateResource($name, $dir = null, $first = true)
255255
throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.',
256256
$file,
257257
$resourceBundle,
258-
$dir.'/'.$bundles[0]->getName().$overridePath
258+
$dir.'/'.$bundle->getName().$overridePath
259259
));
260260
}
261261

@@ -664,7 +664,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
664664
$fs = new Filesystem();
665665

666666
foreach ($content as $file => $code) {
667-
$fs->dumpFile($dir.$file, $code, null);
667+
$fs->dumpFile($dir.$file, $code);
668668
@chmod($dir.$file, 0666 & ~umask());
669669
}
670670

src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,12 @@ public function loadClassMetadata(ClassMetadataInterface $metadata)
6060

6161
return $success;
6262
}
63+
64+
/**
65+
* @return LoaderInterface[]
66+
*/
67+
public function getLoaders()
68+
{
69+
return $this->loader;
70+
}
6371
}

src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function validate($value, Constraint $constraint)
6969
if ($value instanceof \DateTimeImmutable) {
7070
// If $value is immutable, convert the compared value to a
7171
// DateTimeImmutable too
72-
$comparedValue = new \DatetimeImmutable($comparedValue);
72+
$comparedValue = new \DateTimeImmutable($comparedValue);
7373
} elseif ($value instanceof \DateTimeInterface) {
7474
// Otherwise use DateTime
7575
$comparedValue = new \DateTime($comparedValue);

src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,12 @@ public function loadClassMetadata(ClassMetadata $metadata)
5656

5757
return $success;
5858
}
59+
60+
/**
61+
* @return LoaderInterface[]
62+
*/
63+
public function getLoaders()
64+
{
65+
return $this->loader;
66+
}
5967
}

src/Symfony/Component/VarDumper/Caster/DateCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static function formatInterval(\DateInterval $i)
7272
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter)
7373
{
7474
$location = $timeZone->getLocation();
75-
$formatted = (new \Datetime('now', $timeZone))->format($location ? 'e (P)' : 'P');
75+
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
7676
$title = $location && extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
7777

7878
$z = array(Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title));

src/Symfony/Component/VarDumper/Caster/XmlReaderCaster.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@
2020
class XmlReaderCaster
2121
{
2222
private static $nodeTypes = array(
23-
\XmlReader::NONE => 'NONE',
24-
\XmlReader::ELEMENT => 'ELEMENT',
25-
\XmlReader::ATTRIBUTE => 'ATTRIBUTE',
26-
\XmlReader::TEXT => 'TEXT',
27-
\XmlReader::CDATA => 'CDATA',
28-
\XmlReader::ENTITY_REF => 'ENTITY_REF',
29-
\XmlReader::ENTITY => 'ENTITY',
30-
\XmlReader::PI => 'PI (Processing Instruction)',
31-
\XmlReader::COMMENT => 'COMMENT',
32-
\XmlReader::DOC => 'DOC',
33-
\XmlReader::DOC_TYPE => 'DOC_TYPE',
34-
\XmlReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
35-
\XmlReader::NOTATION => 'NOTATION',
36-
\XmlReader::WHITESPACE => 'WHITESPACE',
37-
\XmlReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
38-
\XmlReader::END_ELEMENT => 'END_ELEMENT',
39-
\XmlReader::END_ENTITY => 'END_ENTITY',
40-
\XmlReader::XML_DECLARATION => 'XML_DECLARATION',
23+
\XMLReader::NONE => 'NONE',
24+
\XMLReader::ELEMENT => 'ELEMENT',
25+
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
26+
\XMLReader::TEXT => 'TEXT',
27+
\XMLReader::CDATA => 'CDATA',
28+
\XMLReader::ENTITY_REF => 'ENTITY_REF',
29+
\XMLReader::ENTITY => 'ENTITY',
30+
\XMLReader::PI => 'PI (Processing Instruction)',
31+
\XMLReader::COMMENT => 'COMMENT',
32+
\XMLReader::DOC => 'DOC',
33+
\XMLReader::DOC_TYPE => 'DOC_TYPE',
34+
\XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
35+
\XMLReader::NOTATION => 'NOTATION',
36+
\XMLReader::WHITESPACE => 'WHITESPACE',
37+
\XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
38+
\XMLReader::END_ELEMENT => 'END_ELEMENT',
39+
\XMLReader::END_ENTITY => 'END_ENTITY',
40+
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
4141
);
4242

43-
public static function castXmlReader(\XmlReader $reader, array $a, Stub $stub, $isNested)
43+
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
4444
{
4545
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
4646
$info = array(
@@ -49,17 +49,17 @@ public static function castXmlReader(\XmlReader $reader, array $a, Stub $stub, $
4949
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
5050
'depth' => $reader->depth,
5151
'isDefault' => $reader->isDefault,
52-
'isEmptyElement' => \XmlReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
52+
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
5353
'xmlLang' => $reader->xmlLang,
5454
'attributeCount' => $reader->attributeCount,
5555
'value' => $reader->value,
5656
'namespaceURI' => $reader->namespaceURI,
5757
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
5858
$props => array(
59-
'LOADDTD' => $reader->getParserProperty(\XmlReader::LOADDTD),
60-
'DEFAULTATTRS' => $reader->getParserProperty(\XmlReader::DEFAULTATTRS),
61-
'VALIDATE' => $reader->getParserProperty(\XmlReader::VALIDATE),
62-
'SUBST_ENTITIES' => $reader->getParserProperty(\XmlReader::SUBST_ENTITIES),
59+
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
60+
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
61+
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
62+
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
6363
),
6464
);
6565

src/Symfony/Component/Yaml/Inline.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ class Inline
3434
private static $objectForMap = false;
3535
private static $constantSupport = false;
3636

37-
/**
38-
* @param int $flags
39-
* @param int|null $parsedLineNumber
40-
* @param string|null $parsedFilename
41-
*/
42-
public static function initialize($flags, $parsedLineNumber = null, $parsedFilename = null)
37+
public static function initialize(int $flags, int $parsedLineNumber = null, string $parsedFilename = null)
4338
{
4439
self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags);
4540
self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags);
@@ -63,7 +58,7 @@ public static function initialize($flags, $parsedLineNumber = null, $parsedFilen
6358
*
6459
* @throws ParseException
6560
*/
66-
public static function parse(string $value = null, int $flags = 0, array $references = array())
61+
public static function parse(?string $value, int $flags = 0, array $references = array())
6762
{
6863
self::initialize($flags);
6964

0 commit comments

Comments
 (0)
0