8000 Merge branch '6.4' into 7.0 · symfony/routing@78bff88 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78bff88

Browse files
Merge branch '6.4' into 7.0
* 6.4: Use typed properties in tests as much as possible
2 parents 1414dc4 + 2861f2a commit 78bff88

File tree

5 files changed

+14
-42
lines changed

5 files changed

+14
-42
lines changed

Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,10 @@ class CompiledUrlGeneratorDumperTest extends TestCase
2626
{
2727
use ExpectDeprecationTrait;
2828

29-
/**
30-
* @var RouteCollection
31-
*/
32-
private $routeCollection;
33-
34-
/**
35-
* @var CompiledUrlGeneratorDumper
36-
*/
37-
private $generatorDumper;
38-
39-
/**
40-
* @var string
41-
*/
42-
private $testTmpFilepath;
43-
44-
/**
45-
* @var string
46-
*/
47-
private $largeTestTmpFilepath;
29+
private RouteCollection $routeCollection;
30+
private CompiledUrlGeneratorDumper $generatorDumper;
31+
private string $testTmpFilepath;
32+
private string $largeTestTmpFilepath;
4833

4934
protected function setUp(): void
5035
{
@@ -63,10 +48,6 @@ protected function tearDown(): void
6348
parent::tearDown();
6449

6550
@unlink($this->testTmpFilepath);
66-
67-
$this->routeCollection = null;
68-
$this->generatorDumper = null;
69-
$this->testTmpFilepath = null;
7051
}
7152

7253
public function testDumpWithRoutes()
@@ -166,7 +147,6 @@ public function testDumpWithTooManyRoutes()
166147
$this->routeCollection->add('Test2', new Route('/testing2'));
167148

168149
file_put_contents($this->largeTestTmpFilepath, $this->generatorDumper->dump());
169-
$this->routeCollection = $this->generatorDumper = null;
170150

171151
$projectUrlGenerator = new CompiledUrlGenerator(require $this->largeTestTmpFilepath, new RequestContext('/app.php'));
172152

Tests/Loader/ObjectLoaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testExceptionOnMethodNotReturningCollection()
9696

9797
class TestObjectLoader extends ObjectLoader
9898
{
99-
public $loaderMap = [];
99+
public array $loaderMap = [];
100100

101101
public function supports(mixed $resource, string $type = null): bool
102102
{
@@ -111,8 +111,8 @@ protected function getObject(string $id): object
111111

112112
class TestObjectLoaderRouteService
113113
{
114-
private $collection;
115-
private $env;
114+
private RouteCollection $collection;
115+
private ?string $env;
116116

117117
public function __construct($collection, string $env = null)
118118
{

Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424

2525
class CompiledUrlMatcherDumperTest extends TestCase
2626
{
27-
/**
28-
* @var string
29-
*/
30-
private $dumpPath;
27+
private string $dumpPath;
3128

3229
protected function setUp(): void
3330
{

Tests/Matcher/ExpressionLanguageProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
class ExpressionLanguageProviderTest extends TestCase
2121
{
22-
private $context;
23-
private $expressionLanguage;
22+
private RequestContext $context;
23+
private ExpressionLanguage $expressionLanguage;
2424

2525
protected function setUp(): void
2626
{

Tests/RouterTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Routing\Tests;
1313

14+
use PHPUnit\Framework\MockObject\MockObject;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\Config\Loader\LoaderInterface;
1617
use Symfony\Component\HttpFoundation\Request;
@@ -25,11 +26,9 @@
2526

2627
class RouterTest extends TestCase
2728
{
28-
private $router;
29-
30-
private $loader;
31-
32-
private $cacheDir;
29+
private Router $rou 9142 ter;
30+
private MockObject&LoaderInterface $loader;
31+
private string $cacheDir;
3332

3433
protected function setUp(): void
3534
{
@@ -45,10 +44,6 @@ protected function tearDown(): void
4544
array_map('unlink', glob($this->cacheDir.\DIRECTORY_SEPARATOR.'*'));
4645
@rmdir($this->cacheDir);
4746
}
48-
49-
$this->loader = null;
50-
$this->router = null;
51-
$this->cacheDir = null;
5247
}
5348

5449
public function testSetOptionsWithSupportedOptions()

0 commit comments

Comments
 (0)
0