Skip to content

Commit 05b4f0d

Browse files
authored
Merge pull request #21 from samsonasik/apply-php74
Apply PHP 7.4 syntax and typed property
2 parents 8308a09 + 602b1b7 commit 05b4f0d

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

src/LaminasRouter.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,25 @@ class LaminasRouter implements RouterInterface
3737

3838
/**
3939
* Store the HTTP methods allowed for each path.
40-
*
41-
* @var array
4240
*/
43-
private $allowedMethodsByPath = [];
41+
private array $allowedMethodsByPath = [];
4442

4543
/**
4644
* Map a named route to a Laminas route name to use for URI generation.
47-
*
48-
* @var array
4945
*/
50-
private $routeNameMap = [];
46+
private array $routeNameMap = [];
5147

5248
/** @var Route[] */
53-
private $routes = [];
49+
private array $routes = [];
5450

5551
/**
5652
* Routes aggregated to inject.
5753
*
5854
* @var Route[]
5955
*/
60-
private $routesToInject = [];
56+
private array $routesToInject = [];
6157

62-
/** @var TreeRouteStack */
63-
private $laminasRouter;
58+
private TreeRouteStack $laminasRouter;
6459

6560
/**
6661
* Lazy instantiates a TreeRouteStack if none is provided.

test/LaminasRouter/ConfigProviderTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
class ConfigProviderTest extends TestCase
1313
{
14-
/** @var ConfigProvider */
15-
private $provider;
14+
private ConfigProvider $provider;
1615

1716
protected function setUp(): void
1817
{

test/LaminasRouterTest.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class LaminasRouterTest extends TestCase
3232
/** @var TreeRouteStack|ObjectProphecy */
3333
private $laminasRouter;
3434
/** @var Route[] */
35-
private $routesToInject;
35+
private ?array $routesToInject = null;
3636

3737
protected function setUp(): void
3838
{
@@ -52,9 +52,7 @@ private function getMiddleware(): MiddlewareInterface
5252
public function testWillLazyInstantiateALaminasTreeRouteStackIfNoneIsProvidedToConstructor(): void
5353
{
5454
$router = new LaminasRouter();
55-
$laminasRouter = Closure::bind(function () {
56-
return $this->laminasRouter;
57-
}, $router, LaminasRouter::class)();
55+
$laminasRouter = Closure::bind(fn() => $this->laminasRouter, $router, LaminasRouter::class)();
5856
$this->assertInstanceOf(TreeRouteStack::class, $laminasRouter);
5957
}
6058

@@ -85,9 +83,7 @@ public function testAddingRouteAggregatesInRouter(): void
8583
$router = $this->getRouter();
8684
$router->addRoute($route);
8785

88-
$routesToInject = Closure::bind(function () {
89-
return $this->routesToInject;
90-
}, $router, LaminasRouter::class)();
86+
$routesToInject = Closure::bind(fn() => $this->routesToInject, $router, LaminasRouter::class)();
9187
$this->assertContains($route, $routesToInject);
9288
}
9389

0 commit comments

Comments
 (0)