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:
commit
1facaad976
@ -248,7 +248,7 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function displayGeneralJson(SymfonyStyle $io, $filter)
|
private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
|
||||||
{
|
{
|
||||||
$decorated = $io->isDecorated();
|
$decorated = $io->isDecorated();
|
||||||
$types = ['functions', 'filters', 'tests', 'globals'];
|
$types = ['functions', 'filters', 'tests', 'globals'];
|
||||||
@ -302,7 +302,7 @@ EOF
|
|||||||
return $loaderPaths;
|
return $loaderPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getMetadata($type, $entity)
|
private function getMetadata(string $type, $entity)
|
||||||
{
|
{
|
||||||
if ('globals' === $type) {
|
if ('globals' === $type) {
|
||||||
return $entity;
|
return $entity;
|
||||||
@ -358,7 +358,7 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPrettyMetadata($type, $entity, $decorated)
|
private function getPrettyMetadata(string $type, $entity, bool $decorated)
|
||||||
{
|
{
|
||||||
if ('tests' === $type) {
|
if ('tests' === $type) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -118,7 +118,7 @@ EOF
|
|||||||
throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
|
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();
|
$realLoader = $this->twig->getLoader();
|
||||||
try {
|
try {
|
||||||
@ -136,7 +136,7 @@ EOF
|
|||||||
return ['template' => $template, 'file' => $file, 'valid' => true];
|
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')) {
|
switch ($input->getOption('format')) {
|
||||||
case 'txt':
|
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;
|
$errors = 0;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ EOF
|
|||||||
return min($errors, 1);
|
return min($errors, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function displayJson(OutputInterface $output, $filesInfo)
|
private function displayJson(OutputInterface $output, array $filesInfo)
|
||||||
{
|
{
|
||||||
$errors = 0;
|
$errors = 0;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ EOF
|
|||||||
return min($errors, 1);
|
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();
|
$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);
|
$lines = explode("\n", $template);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
|
|||||||
return $this->profile;
|
return $this->profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getComputedData($index)
|
private function getComputedData(string $index)
|
||||||
{
|
{
|
||||||
if (null === $this->computed) {
|
if (null === $this->computed) {
|
||||||
$this->computed = $this->computeData($this->getProfile());
|
$this->computed = $this->computeData($this->getProfile());
|
||||||
|
@ -116,7 +116,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
|||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function isNamedArguments($arguments)
|
private function isNamedArguments(Node $arguments)
|
||||||
{
|
{
|
||||||
foreach ($arguments as $name => $node) {
|
foreach ($arguments as $name => $node) {
|
||||||
if (!\is_int($name)) {
|
if (!\is_int($name)) {
|
||||||
|
Reference in New Issue
Block a user