Skip to content

Commit 4336665

Browse files
Replace more docblocks by type-hints
1 parent 4d16f84 commit 4336665

20 files changed

+58
-266
lines changed

CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
3030
* @param string $phpArrayFile The PHP file where metadata are cached
3131
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
3232
*/
33-
public function __construct($phpArrayFile, CacheItemPoolInterface $fallbackPool)
33+
public function __construct(string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
3434
{
3535
$this->phpArrayFile = $phpArrayFile;
3636
if (!$fallbackPool instanceof AdapterInterface) {

CacheWarmer/AnnotationsCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
3333
* @param string $phpArrayFile The PHP file where annotations are cached
3434
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered annotations are cached
3535
*/
36-
public function __construct(Reader $annotationReader, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
36+
public function __construct(Reader $annotationReader, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
3737
{
3838
parent::__construct($phpArrayFile, $fallbackPool);
3939
$this->annotationReader = $annotationReader;

CacheWarmer/SerializerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
3535
* @param string $phpArrayFile The PHP file where metadata are cached
3636
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
3737
*/
38-
public function __construct(array $loaders, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
38+
public function __construct(array $loaders, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
3939
{
4040
parent::__construct($phpArrayFile, $fallbackPool);
4141
$this->loaders = $loaders;

CacheWarmer/TemplateFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TemplateFinder implements TemplateFinderInterface
3434
* @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
3535
* @param string $rootDir The directory where global templates can be stored
3636
*/
37-
public function __construct(KernelInterface $kernel, TemplateNameParserInterface $parser, $rootDir)
37+
public function __construct(KernelInterface $kernel, TemplateNameParserInterface $parser, string $rootDir)
3838
{
3939
$this->kernel = $kernel;
4040
$this->parser = $parser;

CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
3737
* @param string $phpArrayFile The PHP file where metadata are cached
3838
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
3939
*/
40-
public function __construct(ValidatorBuilderInterface $validatorBuilder, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
40+
public function __construct(ValidatorBuilderInterface $validatorBuilder, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
4141
{
4242
parent::__construct($phpArrayFile, $fallbackPool);
4343
$this->validatorBuilder = $validatorBuilder;

Command/CacheClearCommand.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ class CacheClearCommand extends Command
3737
private $cacheClearer;
3838
private $filesystem;
3939

40-
/**
41-
* @param CacheClearerInterface $cacheClearer
42-
* @param Filesystem|null $filesystem
43-
*/
4440
public function __construct(CacheClearerInterface $cacheClearer, Filesystem $filesystem = null)
4541
{
4642
parent::__construct();
@@ -79,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7975
$io = new SymfonyStyle($input, $output);
8076

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

Command/CachePoolPruneCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class CachePoolPruneCommand extends Command
3131
/**
3232
* @param iterable|PruneableInterface[] $pools
3333
*/
34-
public function __construct($pools)
34+
public function __construct(iterable $pools)
3535
{
3636
parent::__construct();
3737

Console/Descriptor/JsonDescriptor.php

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,7 @@ protected function getRouteData(Route $route)
207207
);
208208
}
209209

210-
/**
211-
* @param Definition $definition
212-
* @param bool $omitTags
213-
*
214-
* @return array
215-
*/
216-
private function getContainerDefinitionData(Definition $definition, $omitTags = false, $showArguments = false)
210+
private function getContainerDefinitionData(Definition $definition, bool $omitTags = false, bool $showArguments = false): array
217211
{
218212
$data = array(
219213
'class' => (string) $definition->getClass(),
@@ -267,24 +261,15 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
267261
return $data;
268262
}
269263

270-
/**
271-
* @return array
272-
*/
273-
private function getContainerAliasData(Alias $alias)
264+
private function getContainerAliasData(Alias $alias): array
274265
{
275266
return array(
276267
'service' => (string) $alias,
277268
'public' => $alias->isPublic(),
278269
);
279270
}
280271

281-
/**
282-
* @param EventDispatcherInterface $eventDispatcher
283-
* @param string|null $event
284-
*
285-
* @return array
286-
*/
287-
private function getEventDispatcherListenersData(EventDispatcherInterface $eventDispatcher, $event = null)
272+
private function getEventDispatcherListenersData(EventDispatcherInterface $eventDispatcher, string $event = null): array
288273
{
289274
$data = array();
290275

@@ -310,13 +295,7 @@ private function getEventDispatcherListenersData(EventDispatcherInterface $event
310295
return $data;
311296
}
312297

313-
/**
314-
* @param callable $callable
315-
* @param array $options
316-
*
317-
* @return array
318-
*/
319-
private function getCallableData($callable, array $options = array())
298+
private function getCallableData($callable, array $options = array()): array
320299
{
321300
$data = array();
322301

Console/Descriptor/TextDescriptor.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,7 @@ private function renderEventListenerTable(EventDispatcherInterface $eventDispatc
426426
$io->table($tableHeaders, $tableRows);
427427
}
428428

429-
/**
430-
* @param array $config
431-
*
432-
* @return string
433-
*/
434-
private function formatRouterConfig(array $config)
429+
private function formatRouterConfig(array $config): string
435430
{
436431
if (empty($config)) {
437432
return 'NONE';
@@ -447,12 +442,7 @@ private function formatRouterConfig(array $config)
447442
return trim($configAsString);
448443
}
449444

450-
/**
451-
* @param callable $callable
452-
*
453-
* @return string
454-
*/
455-
private function formatCallable($callable)
445+
private function formatCallable($callable): string
456446
{
457447
if (is_array($callable)) {
458448
if (is_object($callable[0])) {
@@ -477,11 +467,7 @@ private function formatCallable($callable)
477467
throw new \InvalidArgumentException('Callable is not describable.');
478468
}
479469

480-
/**
481-
* @param string $content
482-
* @param array $options
483-
*/
484-
private function writeText($content, array $options = array())
470+
private function writeText(string $content, array $options = array())
485471
{
486472
$this->write(
487473
isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,

Console/Descriptor/XmlDescriptor.php

Lines changed: 11 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ private function writeDocument(\DOMDocument $dom)
141141
$this->write($dom->saveXML());
142142
}
143143

144-
/**
145-
* @return \DOMDocument
146-
*/
147-
private function getRouteCollectionDocument(RouteCollection $routes)
144+
private function getRouteCollectionDocument(RouteCollection $routes): \DOMDocument
148145
{
149146
$dom = new \DOMDocument('1.0', 'UTF-8');
150147
$dom->appendChild($routesXML = $dom->createElement('routes'));
@@ -157,13 +154,7 @@ private function getRouteCollectionDocument(RouteCollection $routes)
157154
return $dom;
158155
}
159156

160-
/**
161-
* @param Route $route
162-
* @param string|null $name
163-
*
164-
* @return \DOMDocument
165-
*/
166-
private function getRouteDocument(Route $route, $name = null)
157+
private function getRouteDocument(Route $route, string $name = null): \DOMDocument
167158
{
168159
$dom = new \DOMDocument('1.0', 'UTF-8');
169160
$dom->appendChild($routeXML = $dom->createElement('route'));
@@ -226,10 +217,7 @@ private function getRouteDocument(Route $route, $name = null)
226217
return $dom;
227218
}
228219

229-
/**
230-
* @return \DOMDocument
231-
*/
232-
private function getContainerParametersDocument(ParameterBag $parameters)
220+
private function getContainerParametersDocument(ParameterBag $parameters): \DOMDocument
233221
{
234222
$dom = new \DOMDocument('1.0', 'UTF-8');
235223
$dom->appendChild($parametersXML = $dom->createElement('parameters'));
@@ -243,13 +231,7 @@ private function getContainerParametersDocument(ParameterBag $parameters)
243231
return $dom;
244232
}
245233

246-
/**
247-
* @param ContainerBuilder $builder
248-
* @param bool $showPrivate
249-
*
250-
* @return \DOMDocument
251-
*/
252-
private function getContainerTagsDocument(ContainerBuilder $builder, $showPrivate = false)
234+
private function getContainerTagsDocument(ContainerBuilder $builder, bool $showPrivate = false): \DOMDocument
253235
{
254236
$dom = new \DOMDocument('1.0', 'UTF-8');
255237
$dom->appendChild($containerXML = $dom->createElement('container'));
@@ -267,15 +249,7 @@ private function getContainerTagsDocument(ContainerBuilder $builder, $showPrivat
267249
return $dom;
268250
}
269251

270-
/**
271-
* @param mixed $service
272-
* @param string $id
273-
* @param ContainerBuilder|null $builder
274-
* @param bool $showArguments
275-
*
276-
* @return \DOMDocument
277-
*/
278-
private function getContainerServiceDocument($service, $id, ContainerBuilder $builder = null, $showArguments = false)
252+
private function getContainerServiceDocument($service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
279253
{
280254
$dom = new \DOMDocument('1.0', 'UTF-8');
281255

@@ -295,16 +269,7 @@ private function getContainerServiceDocument($service, $id, ContainerBuilder $bu
295269
return $dom;
296270
}
297271

298-
/**
299-
* @param ContainerBuilder $builder
300-
* @param string|null $tag
301-
* @param bool $showPrivate
302-
* @param bool $showArguments
303-
* @param callable $filter
304-
*
305-
* @return \DOMDocument
306-
*/
307-
private function getContainerServicesDocument(ContainerBuilder $builder, $tag = null, $showPrivate = false, $showArguments = false, $filter = null)
272+
private function getContainerServicesDocument(ContainerBuilder $builder, string $tag = null, bool $showPrivate = false, bool $showArguments = false, callable $filter = null): \DOMDocument
308273
{
309274
$dom = new \DOMDocument('1.0', 'UTF-8');
310275
$dom->appendChild($containerXML = $dom->createElement('container'));
@@ -329,14 +294,7 @@ private function getContainerServicesDocument(ContainerBuilder $builder, $tag =
329294
return $dom;
330295
}
331296

332-
/**
333-
* @param Definition $definition
334-
* @param string|null $id
335-
* @param bool $omitTags
336-
*
337-
* @return \DOMDocument
338-
*/
339-
private function getContainerDefinitionDocument(Definition $definition, $id = null, $omitTags = false, $showArguments = false)
297+
private function getContainerDefinitionDocument(Definition $definition, string $id = null, bool $omitTags = false, bool $showArguments = false): \DOMDocument
340298
{
341299
$dom = new \DOMDocument('1.0', 'UTF-8');
342300
$dom->appendChild($serviceXML = $dom->createElement('definition'));
@@ -453,13 +411,7 @@ private function getArgumentNodes(array $arguments, \DOMDocument $dom)
453411
return $nodes;
454412
}
455413

456-
/**
457-
* @param Alias $alias
458-
* @param string|null $id
459-
*
460-
* @return \DOMDocument
461-
*/
462-
private function getContainerAliasDocument(Alias $alias, $id = null)
414+
private function getContainerAliasDocument(Alias $alias, string $id = null): \DOMDocument
463415
{
464416
$dom = new \DOMDocument('1.0', 'UTF-8');
465417
$dom->appendChild($aliasXML = $dom->createElement('alias'));
@@ -474,10 +426,7 @@ private function getContainerAliasDocument(Alias $alias, $id = null)
474426
return $dom;
475427
}
476428

477-
/**
478-
* @return \DOMDocument
479-
*/
480-
private function getContainerParameterDocument($parameter, $options = array())
429+
private function getContainerParameterDocument($parameter, $options = array()): \DOMDocument
481430
{
482431
$dom = new \DOMDocument('1.0', 'UTF-8');
483432
$dom->appendChild($parameterXML = $dom->createElement('parameter'));
@@ -491,13 +440,7 @@ private function getContainerParameterDocument($parameter, $options = array())
491440
return $dom;
492441
}
493442

494-
/**
495-
* @param EventDispatcherInterface $eventDispatcher
496-
* @param string|null $event
497-
*
498-
* @return \DOMDocument
499-
*/
500-
private function getEventDispatcherListenersDocument(EventDispatcherInterface $eventDispatcher, $event = null)
443+
private function getEventDispatcherListenersDocument(EventDispatcherInterface $eventDispatcher, string $event = null): \DOMDocument
501444
{
502445
$dom = new \DOMDocument('1.0', 'UTF-8');
503446
$dom->appendChild($eventDispatcherXML = $dom->createElement('event-dispatcher'));
@@ -529,12 +472,7 @@ private function appendEventListenerDocument(EventDispatcherInterface $eventDisp
529472
}
530473
}
531474

532-
/**
533-
* @param callable $callable
534-
*
535-
* @return \DOMDocument
536-
*/
537-
private function getCallableDocument($callable)
475+
private function getCallableDocument($callable): \DOMDocument
538476
{
539477
$dom = new \DOMDocument('1.0', 'UTF-8');
540478
$dom->appendChild($callableXML = $dom->createElement('callable'));

0 commit comments

Comments
 (0)