Skip to content

Commit 90bd33a

Browse files
Merge branch '4.4'
* 4.4: Fix assertInternalType deprecation in phpunit 9 Micro-typo fix add parameter type declarations to private methods
2 parents f6fec04 + 060f552 commit 90bd33a

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

Loader/Configurator/CollectionConfigurator.php

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

89-
private function createRoute($path): Route
89+
private function createRoute(string $path): Route
9090
{
9191
return (clone $this->route)->setPath($path);
9292
}

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,

Tests/Matcher/UrlMatcherTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Routing\Tests\Matcher;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
1617
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
1718
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -21,13 +22,15 @@
2122

2223
class UrlMatcherTest extends TestCase
2324
{
25+
use ForwardCompatTestTrait;
26+
2427
public function testNoMethodSoAllowed()
2528
{
2629
$coll = new RouteCollection();
2730
$coll->add('foo', new Route('/foo'));
2831

2932
$matcher = $this->getUrlMatcher($coll);
30-
$this->assertInternalType('array', $matcher->match('/foo'));
33+
$this->assertIsArray($matcher->match('/foo'));
3134
}
3235

3336
public function testMethodNotAllowed()
@@ -66,7 +69,7 @@ public function testHeadAllowedWhenRequirementContainsGet()
6669
$coll->add('foo', new Route('/foo', [], [], [], '', [], ['get']));
6770

6871
$matcher = $this->getUrlMatcher($coll, new RequestContext('', 'head'));
69-
$this->assertInternalType('array', $matcher->match('/foo'));
72+
$this->assertIsArray($matcher->match('/foo'));
7073
}
7174

7275
public function testMethodNotAllowedAggregatesAllowedMethods()
@@ -114,7 +117,7 @@ public function testMethodIsIgnoredIfNoMethodGiven()
114117
$collection = new RouteCollection();
115118
$collection->add('foo', new Route('/foo', [], [], [], '', [], ['get', 'head']));
116119
$matcher = $this->getUrlMatcher($collection);
117-
$this->assertInternalType('array', $matcher->match('/foo'));
120+
$this->assertIsArray($matcher->match('/foo'));
118121

119122
// route does not match with POST method context
120123
$matcher = $this->getUrlMatcher($collection, new RequestContext('', 'post'));
@@ -126,9 +129,9 @@ public function testMethodIsIgnoredIfNoMethodGiven()
126129

127130
// route does match with GET or HEAD method context
128131
$matcher = $this->getUrlMatcher($collection);
129-
$this->assertInternalType('array', $matcher->match('/foo'));
132+
$this->assertIsArray($matcher->match('/foo'));
130133
$matcher = $this->getUrlMatcher($collection, new RequestContext('', 'head'));
131-
$this->assertInternalType('array', $matcher->match('/foo'));
134+
$this->assertIsArray($matcher->match('/foo'));
132135
}
133136

134137
public function testRouteWithOptionalVariableAsFirstSegment()

0 commit comments

Comments
 (0)