Skip to content

Commit 7be54bb

Browse files
wouterjnicolas-grekas
authored andcommitted
Add PHP types to private methods and functions
1 parent 0934427 commit 7be54bb

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Command/LintCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private function display(InputInterface $input, OutputInterface $output, Symfony
179179
};
180180
}
181181

182-
private function displayTxt(OutputInterface $output, SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false)
182+
private function displayTxt(OutputInterface $output, SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int
183183
{
184184
$errors = 0;
185185
$githubReporter = $errorAsGithubAnnotations ? new GithubActionReporter($output) : null;
@@ -254,7 +254,7 @@ private function renderException(SymfonyStyle $output, string $template, Error $
254254
}
255255
}
256256

257-
private function getContext(string $template, int $line, int $context = 3)
257+
private function getContext(string $template, int $line, int $context = 3): array
258258
{
259259
$lines = explode("\n", $template);
260260

DataCollector/TwigDataCollector.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,37 +78,37 @@ public function lateCollect()
7878
$templateFinder($this->profile);
7979
}
8080

81-
public function getTime()
81+
public function getTime(): int
8282
{
8383
return $this->getProfile()->getDuration() * 1000;
8484
}
8585

86-
public function getTemplateCount()
86+
public function getTemplateCount(): int
8787
{
8888
return $this->getComputedData('template_count');
8989
}
9090

91-
public function getTemplatePaths()
91+
public function getTemplatePaths(): array
9292
{
9393
return $this->data['template_paths'];
9494
}
9595

96-
public function getTemplates()
96+
public function getTemplates(): array
9797
{
9898
return $this->getComputedData('templates');
9999
}
100100

101-
public function getBlockCount()
101+
public function getBlockCount(): int
102102
{
103103
return $this->getComputedData('block_count');
104104
}
105105

106-
public function getMacroCount()
106+
public function getMacroCount(): int
107107
{
108108
return $this->getComputedData('macro_count');
109109
}
110110

111-
public function getHtmlCallGraph()
111+
public function getHtmlCallGraph(): Markup
112112
{
113113
$dumper = new HtmlDumper();
114114
$dump = $dumper->dump($this->getProfile());
@@ -129,7 +129,7 @@ public function getHtmlCallGraph()
129129
return new Markup($dump, 'UTF-8');
130130
}
131131

132-
public function getProfile()
132+
public function getProfile(): Profile
133133
{
134134
return $this->profile ??= unserialize($this->data['profile'], ['allowed_classes' => ['Twig_Profiler_Profile', Profile::class]]);
135135
}
@@ -141,7 +141,7 @@ private function getComputedData(string $index)
141141
return $this->computed[$index];
142142
}
143143

144-
private function computeData(Profile $profile)
144+
private function computeData(Profile $profile): array
145145
{
146146
$data = [
147147
'template_count' => 0,

0 commit comments

Comments
 (0)