Skip to content

Commit 3d15336

Browse files
committed
minor #32786 add parameter type declarations to private methods (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- 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 ------- 1b2aaa4a06 add parameter type declarations to private methods
2 parents 1e022fa + 8d6dbe2 commit 3d15336

File tree

7 files changed

+9
-18
lines changed

7 files changed

+9
-18
lines changed

Loader/Configurator/CollectionConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ final public function prefix($prefix)
8888
return $this;
8989
}
9090

91-
private function createRoute($path): Route
91+
private function createRoute(string $path): Route
9292
{
9393
return (clone $this->route)->setPath($path);
9494
}

Loader/Configurator/Traits/AddTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ final public function __invoke(string $name, $path): RouteConfigurator
8383
return $this->add($name, $path);
8484
}
8585

86-
private function createRoute($path): Route
86+
private function createRoute(string $path): Route
8787
{
8888
return new Route($path);
8989
}

Loader/XmlFileLoader.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,11 @@ protected function loadFile($file)
253253
/**
254254
* Parses the config elements (default, requirement, option).
255255
*
256-
* @param \DOMElement $node Element to parse that contains the configs
257-
* @param string $path Full path of the XML file being processed
258-
*
259256
* @return array An array with the defaults as first item, requirements as second and options as third
260257
*
261258
* @throws \InvalidArgumentException When the XML is invalid
262259
*/
263-
private function parseConfigs(\DOMElement $node, $path)
260+
private function parseConfigs(\DOMElement $node, string $path)
264261
{
265262
$defaults = [];
266263
$requirements = [];
@@ -329,12 +326,9 @@ private function parseConfigs(\DOMElement $node, $path)
329326
/**
330327
* Parses the "default" elements.
331328
*
332-
* @param \DOMElement $element The "default" element to parse
333-
* @param string $path Full path of the XML file being processed
334-
*
335329
* @return array|bool|float|int|string|null The parsed value of the "default" element
336330
*/
337-
private function parseDefaultsConfig(\DOMElement $element, $path)
331+
private function parseDefaultsConfig(\DOMElement $element, string $path)
338332
{
339333
if ($this->isElementValueNull($element)) {
340334
return;
@@ -364,14 +358,11 @@ private function parseDefaultsConfig(\DOMElement $element, $path)
364358
/**
365359
* Recursively parses the value of a "default" element.
366360
*
367-
* @param \DOMElement $node The node value
368-
* @param string $path Full path of the XML file being processed
369-
*
370361
* @return array|bool|float|int|string The parsed value
371362
*
372363
* @throws \InvalidArgumentException when the XML is invalid
373364
*/
374-
private function parseDefaultNode(\DOMElement $node, $path)
365+
private function parseDefaultNode(\DOMElement $node, string $path)
375366
{
376367
if ($this->isElementValueNull($node)) {
377368
return;

Matcher/Dumper/CompiledUrlMatcherDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ private function getExpressionLanguage()
455455
return $this->expressionLanguage;
456456
}
457457

458-
private function indent($code, $level = 1)
458+
private function indent(string $code, int $level = 1)
459459
{
460460
return preg_replace('/^./m', str_repeat(' ', $level).'$0', $code);
461461
}

Matcher/TraceableUrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes)
129129
}
130130
}
131131

132-
private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null)
132+
private function addTrace(string $log, int $level = self::ROUTE_DOES_NOT_MATCH, string $name = null, Route $route = null)
133133
{
134134
$this->traces[] = [
135135
'log' => $log,

Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ public function compile()
559559
return $this->compiled = $class::compile($this);
560560
}
561561

562-
private function sanitizeRequirement($key, $regex)
562+
private function sanitizeRequirement(string $key, $regex)
563563
{
564564
if (!\is_string($regex)) {
565565
throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key));

Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ private function getConfigCacheFactory()
420420
return $this->configCacheFactory;
421421
}
422422

423-
private function checkDeprecatedOption($key)
423+
private function checkDeprecatedOption(string $key)
424424
{
425425
switch ($key) {
426426
case 'generator_base_class':

0 commit comments

Comments
 (0)