Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02325f2

Browse filesBrowse files
committed
Add PHP types to private methods and functions
1 parent 5a52dd8 commit 02325f2
Copy full SHA for 02325f2

File tree

Expand file treeCollapse file tree

73 files changed

+250
-265
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

73 files changed

+250
-265
lines changed

‎src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private function addTaggedServices(ContainerBuilder $container): array
124124
return $listenerRefs;
125125
}
126126

127-
private function getEventManagerDef(ContainerBuilder $container, string $name)
127+
private function getEventManagerDef(ContainerBuilder $container, string $name): Definition
128128
{
129129
if (!isset($this->eventManagers[$name])) {
130130
$this->eventManagers[$name] = $container->getDefinition(sprintf($this->managerTemplate, $name));

‎src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function validate(mixed $entity, Constraint $constraint)
193193
->addViolation();
194194
}
195195

196-
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, mixed $value)
196+
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, mixed $value): string
197197
{
198198
if (!\is_object($value) || $value instanceof \DateTimeInterface) {
199199
return $this->formatValue($value, self::PRETTY_DATE);

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ private function displayDeprecations($groups, $configuration)
354354
}
355355
}
356356

357-
private static function getPhpUnitErrorHandler()
357+
private static function getPhpUnitErrorHandler(): callable
358358
{
359359
if (!$eh = self::$errorHandler) {
360360
if (class_exists(Handler::class)) {

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php
+17-53Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,15 @@ private function __construct(array $thresholds = [], $regex = '', $verboseOutput
154154
$this->logFile = $logFile;
155155
}
156156

157-
/**
158-
* @return bool
159-
*/
160-
public function isEnabled()
157+
public function isEnabled(): bool
161158
{
162159
return $this->enabled;
163160
}
164161

165162
/**
166163
* @param DeprecationGroup[] $deprecationGroups
167-
*
168-
* @return bool
169164
*/
170-
public function tolerates(array $deprecationGroups)
165+
public function tolerates(array $deprecationGroups): bool
171166
{
172167
$grandTotal = 0;
173168

@@ -229,10 +224,7 @@ public function toleratesForGroup(string $groupName, array $deprecationGroups):
229224
return true;
230225
}
231226

232-
/**
233-
* @return bool
234-
*/
235-
public function isBaselineDeprecation(Deprecation $deprecation)
227+
public function isBaselineDeprecation(Deprecation $deprecation): bool
236228
{
237229
if ($deprecation->isLegacy()) {
238230
return false;
@@ -260,20 +252,17 @@ public function isBaselineDeprecation(Deprecation $deprecation)
260252
return $result;
261253
}
262254

263-
/**
264-
* @return bool
265-
*/
266-
public function isGeneratingBaseline()
255+
public function isGeneratingBaseline(): bool
267256
{
268257
return $this->generateBaseline;
269258
}
270259

271-
public function getBaselineFile()
260+
public function getBaselineFile(): string
272261
{
273262
return $this->baselineFile;
274263
}
275264

276-
public function writeBaseline()
265+
public function writeBaseline(): void
277266
{
278267
$map = [];
279268
foreach ($this->baselineDeprecations as $location => $messages) {
@@ -290,47 +279,37 @@ public function writeBaseline()
290279

291280
/**
292281
* @param string $message
293-
*
294-
* @return bool
295282
*/
296-
public function shouldDisplayStackTrace($message)
283+
public function shouldDisplayStackTrace($message): bool
297284
{
298285
return '' !== $this->regex && preg_match($this->regex, $message);
299286
}
300287

301-
/**
302-
* @return bool
303-
*/
304-
public function isInRegexMode()
288+
public function isInRegexMode(): bool
305289
{
306290
return '' !== $this->regex;
307291
}
308292

309-
/**
310-
* @return bool
311-
*/
312-
public function verboseOutput($group)
293+
public function verboseOutput($group): bool
313294
{
314295
return $this->verboseOutput[$group];
315296
}
316297

317-
public function shouldWriteToLogFile()
298+
public function shouldWriteToLogFile(): bool: bool: bool: bool
318299
{
319300
return null !== $this->logFile;
320301
}
321302

322-
public function getLogFile()
303+
public function getLogFile(): ?string
323304
{
324305
return $this->logFile;
325306
}
326307

327308
/**
328309
* @param string $serializedConfiguration an encoded string, for instance
329310
* max[total]=1234&max[indirect]=42
330-
*
331-
* @return self
332311
*/
333-
public static function fromUrlEncodedString($serializedConfiguration)
312+
public static function fromUrlEncodedString($serializedConfiguration): self
334313
{
335314
parse_str($serializedConfiguration, $normalizedConfiguration);
336315
foreach (array_keys($normalizedConfiguration) as $key) {
@@ -376,29 +355,20 @@ public static function fromUrlEncodedString($serializedConfiguration)
376355
);
377356
}
378357

379-
/**
380-
* @return self
381-
*/
382-
public static function inDisabledMode()
358+
public static function inDisabledMode(): self
383359
{
384360
$configuration = new self();
385361
$configuration->enabled = false;
386362

387363
return $configuration;
388364
}
389365

390-
/**
391-
* @return self
392-
*/
393-
public static function inStrictMode()
366+
public static function inStrictMode(): self
394367
{
395368
return new self(['total' => 0]);
396369
}
397370

398-
/**
399-
* @return self
400-
*/
401-
public static function inWeakMode()
371+
public static function inWeakMode(): self
402372
{
403373
$verboseOutput = [];
404374
foreach (['unsilenced', 'direct', 'indirect', 'self', 'other'] as $group) {
@@ -408,18 +378,12 @@ public static function inWeakMode()
408378
return new self([], '', $verboseOutput);
409379
}
410380

411-
/**
412-
* @return self
413-
*/
414-
public static function fromNumber($upperBound)
381+
public static function fromNumber($upperBound): self
415382
{
416383
return new self(['total' => $upperBound]);
417384
}
418385

419-
/**
420-
* @return self
421-
*/
422-
public static function fromRegex($regex)
386+
public static function fromRegex($regex): self
423387
{
424388
return new self([], $regex);
425389
}

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ private static function getVendors()
356356
return self::$vendors;
357357
}
358358

359-
private static function addSourcePathsFromPrefixes(array $prefixesByNamespace, array $paths)
359+
private static function addSourcePathsFromPrefixes(array $prefixesByNamespace, array $paths): array
360360
{
361361
foreach ($prefixesByNamespace as $prefixes) {
362362
foreach ($prefixes as $prefix) {

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/DeprecationGroup.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/DeprecationGroup.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,18 @@ public function addNotice()
5050

5151
/**
5252
* @param string $message
53-
*
54-
* @return DeprecationNotice
5553
*/
56-
private function deprecationNotice($message)
54+
private function deprecationNotice($message): DeprecationNotice
5755
{
5856
return $this->deprecationNotices[$message] ?? $this->deprecationNotices[$message] = new DeprecationNotice();
5957
}
6058

61-
public function count()
59+
public function count(): int
6260
{
6361
return $this->count;
6462
}
6563

66-
public function notices()
64+
public function notices(): array
6765
{
6866
return $this->deprecationNotices;
6967
}

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/DeprecationNotice.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/DeprecationNotice.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public function addProceduralOccurrence()
3737
++$this->count;
3838
}
3939

40-
public function getCountsByCaller()
40+
public function getCountsByCaller(): array
4141
{
4242
return $this->countsByCaller;
4343
}
4444

45-
public function count()
45+
public function count(): int
4646
{
4747
return $this->count;
4848
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Command/LintCommand.php
+2-2Lines 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

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php
+9-9Lines 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,

‎src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function validateConfiguration(ExtensionInterface $extension, mixed $conf
129129
}
130130
}
131131

132-
private function initializeBundles()
132+
private function initializeBundles(): array
133133
{
134134
// Re-build bundle manually to initialize DI extensions that can be extended by other bundles in their build() method
135135
// as this method is not called when the container is loaded from the cache.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.