8000 add parameter type declarations to private methods · symfony/symfony@2d7d64b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d7d64b

Browse files
committed
add parameter type declarations to private methods
1 parent b2dadc1 commit 2d7d64b

File tree

158 files changed

+340
-734
lines changed
  • HttpKernel
  • Intl
  • Lock/Store
  • Mailer/Transport/Smtp
  • Messenger
  • Mime
  • PropertyAccess
  • Routing
  • Security
  • Serializer
  • Stopwatch
  • Translation
  • Validator
  • VarDumper
  • Workflow/DependencyInjection
  • Yaml/Command
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    158 files changed

    +340
    -734
    lines changed

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

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -248,7 +248,7 @@ private function displayGeneralText(SymfonyStyle $io, string $filter = null)
    248248
    }
    249249
    }
    250250

    251-
    private function displayGeneralJson(SymfonyStyle $io, $filter)
    251+
    private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
    252252
    {
    253253
    $decorated = $io->isDecorated();
    254254
    $types = ['functions', 'filters', 'tests', 'globals'];
    @@ -302,7 +302,7 @@ private function getLoaderPaths(string $name = null): array
    302302
    return $loaderPaths;
    303303
    }
    304304

    305-
    private function getMetadata($type, $entity)
    305+
    private function getMetadata(string $type, $entity)
    306306
    {
    307307
    if ('globals' === $type) {
    308308
    return $entity;
    @@ -358,7 +358,7 @@ private function getMetadata($type, $entity)
    358358
    }
    359359
    }
    360360

    361-
    private function getPrettyMetadata($type, $entity, $decorated)
    361+
    private function getPrettyMetadata(string $type, $entity, bool $decorated)
    362362
    {
    363363
    if ('tests' === $type) {
    364364
    return '';

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

    Lines changed: 6 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -118,7 +118,7 @@ protected function findFiles($filename)
    118118
    throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
    119119
    }
    120120

    121-
    private function validate($template, $file)
    121+
    private function validate(string $template, $file)
    122122
    {
    123123
    $realLoader = $this->twig->getLoader();
    124124
    try {
    @@ -136,7 +136,7 @@ private function validate($template, $file)
    136136
    return ['template' => $template, 'file' => $file, 'valid' => true];
    137137
    }
    138138

    139-
    private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, $files)
    139+
    private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, array $files)
    140140
    {
    141141
    switch ($input->getOption('format')) {
    142142
    case 'txt':
    @@ -148,7 +148,7 @@ private function display(InputInterface $input, OutputInterface $output, Symfony
    148148
    }
    149149
    }
    150150

    151-
    private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInfo)
    151+
    private function displayTxt(OutputInterface $output, SymfonyStyle $io, array $filesInfo)
    152152
    {
    153153
    $errors = 0;
    154154

    @@ -170,7 +170,7 @@ private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInf
    170170
    return min($errors, 1);
    171171
    }
    172172

    173-
    private function displayJson(OutputInterface $output, $filesInfo)
    173+
    private function displayJson(OutputInterface $output, array $filesInfo)
    174174
    {
    175175
    $errors = 0;
    176176

    @@ -189,7 +189,7 @@ private function displayJson(OutputInterface $output, $filesInfo)
    189189
    return min($errors, 1);
    190190
    }
    191191

    192-
    private function renderException(OutputInterface $output, $template, Error $exception, $file = null)
    192+
    private function renderException(OutputInterface $output, string $template, Error $exception, string $file = null)
    193193
    {
    194194
    $line = $exception->getTemplateLine();
    195195

    @@ -212,7 +212,7 @@ private function renderException(OutputInterface $output, $template, Error $exce
    212212
    }
    213213
    }
    214214

    215-
    private function getContext($template, $line, $context = 3)
    215+
    private function getContext(string $template, int $line, int $context = 3)
    216216
    {
    217217
    $lines = explode("\n", $template);
    218218

    src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -147,7 +147,7 @@ public function getProfile()
    147147
    return $this->profile;
    148148
    }
    149149

    150-
    private function getComputedData($index)
    150+
    private function getComputedData(string $index)
    151151
    {
    152152
    if (null === $this->computed) {
    153153
    $this->computed = $this->computeData($this->getProfile());

    src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -116,7 +116,7 @@ public function getPriority()
    116116
    /**
    117117
    * @return bool
    118118
    */
    119-
    private function isNamedArguments($arguments)
    119+
    private function isNamedArguments(Node $arguments)
    120120
    {
    121121
    foreach ($arguments as $name => $node) {
    122122
    if (!\is_int($name)) {

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

    Lines changed: 1 addition & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -70,11 +70,9 @@ public function findAllTemplates()
    7070
    /**
    7171
    * Find templates in the given directory.
    7272
    *
    73-
    * @param string $dir The folder where to look for templates
    74-
    *
    7573
    * @return TemplateReferenceInterface[]
    7674
    */
    77-
    private function findTemplatesInFolder($dir)
    75+
    private function findTemplatesInFolder(string $dir)
    7876
    {
    7977
    $templates = [];
    8078

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

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -295,7 +295,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
    295295
    $io->table($headers, $rows);
    296296
    }
    297297

    298-
    private function formatState($state): string
    298+
    private function formatState(int $state): string
    299299
    {
    300300
    if (self::MESSAGE_MISSING === $state) {
    301301
    return '<error> missing </error>';

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -165,7 +165,7 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
    165165
    */
    166166
    protected function describeCallable($callable, array $options = [])
    167167
    {
    168-
    $this->writeData($this->getCallableData($callable, $options), $options);
    168+
    $this->writeData($this->getCallableData($callable), $options);
    169169
    }
    170170

    171171
    /**
    @@ -315,7 +315,7 @@ private function getEventDispatcherListenersData(EventDispatcherInterface $event
    315315
    return $data;
    316316
    }
    317317

    318-
    private function getCallableData($callable, array $options = []): array
    318+
    private function getCallableData($callable): array
    319319
    {
    320320
    $data = [];
    321321

    @@ -386,7 +386,7 @@ private function getCallableData($callable, array $options = []): array
    386386
    throw new \InvalidArgumentException('Callable is not describable.');
    387387
    }
    388388

    389-
    private function describeValue($value, $omitTags, $showArguments)
    389+
    private function describeValue($value, bool $omitTags, bool $showArguments)
    390390
    {
    391391
    if (\is_array($value)) {
    392392
    $data = [];

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -503,7 +503,7 @@ protected function describeCallable($callable, array $options = [])
    503503
    $this->writeText($this->formatCallable($callable), $options);
    504504
    }
    505505

    506-
    private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, $event, array $eventListeners, SymfonyStyle $io)
    506+
    private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, string $event, array $eventListeners, SymfonyStyle $io)
    507507
    {
    508508
    $tableHeaders = ['Order', 'Callable', 'Priority'];
    509509
    $tableRows = [];

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -449,7 +449,7 @@ private function getContainerAliasDocument(Alias $alias, string $id = null): \DO
    449449
    return $dom;
    450450
    }
    451451

    452-
    private function getContainerParameterDocument($parameter, $options = []): \DOMDocument
    452+
    private function getContainerParameterDocument($parameter, array $options = []): \DOMDocument
    453453
    {
    454454
    $dom = new \DOMDocument('1.0', 'UTF-8');
    455455
    $dom->appendChild($parameterXML = $dom->createElement('parameter'));
    @@ -485,7 +485,7 @@ private function getEventDispatcherListenersDocument(EventDispatcherInterface $e
    485485
    return $dom;
    486486
    }
    487487

    488-
    private function appendEventListenerDocument(EventDispatcherInterface $eventDispatcher, $event, \DOMElement $element, array $eventListeners)
    488+
    private function appendEventListenerDocument(EventDispatcherInterface $eventDispatcher, string $event, \DOMElement $element, array $eventListeners)
    489489
    {
    490490
    foreach ($eventListeners as $listener) {
    491491
    $callableXML = $this->getCallableDocument($listener);

    src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1060,7 +1060,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
    10601060
    /**
    10611061
    * Returns a definition for an asset package.
    10621062
    */
    1063-
    private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
    1063+
    private function createPackageDefinition(?string $basePath, array $baseUrls, Reference $version)
    10641064
    {
    10651065
    if ($basePath && $baseUrls) {
    10661066
    throw new \LogicException('An asset package cannot have base URLs and base paths.');
    @@ -1076,7 +1076,7 @@ private function createPackageDefinition($basePath, array $baseUrls, Reference $
    10761076
    return $package;
    10771077
    }
    10781078

    1079-
    private function createVersion(ContainerBuilder $container, $version, $format, $jsonManifestPath, $name)
    1079+
    private function createVersion(ContainerBuilder $container, ?string $version, ?string $format, ?string $jsonManifestPath, string $name)
    10801080
    {
    10811081
    // Configuration prevents $version and $jsonManifestPath from being set
    10821082
    if (null !== $version) {
    @@ -1331,7 +1331,7 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co
    13311331
    $this->registerMappingFilesFromConfig($container, $config, $fileRecorder);
    13321332
    }
    13331333

    1334-
    private function registerMappingFilesFromDir($dir, callable $fileRecorder)
    1334+
    private function registerMappingFilesFromDir(string $dir, callable $fileRecorder)
    13351335
    {
    13361336
    foreach (Finder::create()->followLinks()->files()->in($dir)->name('/\.(xml|ya?ml)$/')->sortByName() as $file) {
    13371337
    $fileRecorder($file->getExtension(), $file->getRealPath());
    @@ -1355,7 +1355,7 @@ private function registerMappingFilesFromConfig(ContainerBuilder $container, arr
    13551355
    }
    13561356
    }
    13571357

    1358-
    private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container, $loader)
    1358+
    private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container, LoaderInterface $loader)
    13591359
    {
    13601360
    if (!$this->annotationsConfigEnabled) {
    13611361
    return;

    0 commit comments

    Comments
     (0)
    0