minor #32859 [TwigBridge] add parameter type declarations to private methods (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[TwigBridge] add parameter type declarations to private methods

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

5de019801c add parameter type declarations to private methods
This commit is contained in:
Tobias Schultze 2019-08-02 05:06:38 +02:00
commit 1facaad976
4 changed files with 11 additions and 11 deletions

View File

@ -248,7 +248,7 @@ EOF
}
}
private function displayGeneralJson(SymfonyStyle $io, $filter)
private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
{
$decorated = $io->isDecorated();
$types = ['functions', 'filters', 'tests', 'globals'];
@ -302,7 +302,7 @@ EOF
return $loaderPaths;
}
private function getMetadata($type, $entity)
private function getMetadata(string $type, $entity)
{
if ('globals' === $type) {
return $entity;
@ -358,7 +358,7 @@ EOF
}
}
private function getPrettyMetadata($type, $entity, $decorated)
private function getPrettyMetadata(string $type, $entity, bool $decorated)
{
if ('tests' === $type) {
return '';

View File

@ -118,7 +118,7 @@ EOF
throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
}
private function validate($template, $file)
private function validate(string $template, $file)
{
$realLoader = $this->twig->getLoader();
try {
@ -136,7 +136,7 @@ EOF
return ['template' => $template, 'file' => $file, 'valid' => true];
}
private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, $files)
private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, array $files)
{
switch ($input->getOption('format')) {
case 'txt':
@ -148,7 +148,7 @@ EOF
}
}
private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInfo)
private function displayTxt(OutputInterface $output, SymfonyStyle $io, array $filesInfo)
{
$errors = 0;
@ -170,7 +170,7 @@ EOF
return min($errors, 1);
}
private function displayJson(OutputInterface $output, $filesInfo)
private function displayJson(OutputInterface $output, array $filesInfo)
{
$errors = 0;
@ -189,7 +189,7 @@ EOF
return min($errors, 1);
}
private function renderException(OutputInterface $output, $template, Error $exception, $file = null)
private function renderException(OutputInterface $output, string $template, Error $exception, string $file = null)
{
$line = $exception->getTemplateLine();
@ -212,7 +212,7 @@ EOF
}
}
private function getContext($template, $line, $context = 3)
private function getContext(string $template, int $line, int $context = 3)
{
$lines = explode("\n", $template);

View File

@ -147,7 +147,7 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
return $this->profile;
}
private function getComputedData($index)
private function getComputedData(string $index)
{
if (null === $this->computed) {
$this->computed = $this->computeData($this->getProfile());

View File

@ -116,7 +116,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
/**
* @return bool
*/
private function isNamedArguments($arguments)
private function isNamedArguments(Node $arguments)
{
foreach ($arguments as $name => $node) {
if (!\is_int($name)) {