Skip to content

Commit 20e9072

Browse files
committed
Add type hints
1 parent b9069be commit 20e9072

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/Connector/NetteConnector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class NetteConnector extends Client
2525
*/
2626
protected $containerAccessor;
2727

28-
public function setContainerAccessor(callable $containerAccessor)
28+
public function setContainerAccessor(callable $containerAccessor): void
2929
{
3030
$this->containerAccessor = $containerAccessor;
3131
}
@@ -53,7 +53,7 @@ public function doRequest($request)
5353
$_POST = $request->getParameters();
5454
}
5555

56-
$container = call_user_func($this->containerAccessor);
56+
$container = ($this->containerAccessor)();
5757

5858
$httpRequest = $container->getByType(IRequest::class);
5959
$httpResponse = $container->getByType(IResponse::class);

src/Console/RunTestInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class RunTestInput extends ArgvInput
1818
{
19-
public function __construct(InputDefinition $definition = null)
19+
public function __construct(?InputDefinition $definition = null)
2020
{
2121
$parameters = [$_SERVER['argv'][0], 'run'];
2222

@@ -42,7 +42,7 @@ public function __construct(InputDefinition $definition = null)
4242
parent::__construct($parameters, $definition);
4343
}
4444

45-
private function normalizePath($path)
45+
private function normalizePath(string $path): string
4646
{
4747
return str_replace('\\', '/', $path);
4848
}

src/Http/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(RequestFactory $factory)
3232
$this->reset();
3333
}
3434

35-
public function reset()
35+
public function reset(): void
3636
{
3737
$this->request = $this->factory->createHttpRequest();
3838
}

src/Http/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Response implements IResponse
2525
*/
2626
private $headers = [];
2727

28-
public function reset()
28+
public function reset(): void
2929
{
3030
$this->code = self::S200_OK;
3131
$this->headers = [];

src/Module/NetteApplicationModule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public function _after(TestInterface $test)
6767
/**
6868
* @param bool $followRedirects
6969
*/
70-
public function followRedirects($followRedirects)
70+
public function followRedirects(bool $followRedirects): void
7171
{
7272
$this->client->followRedirects($followRedirects);
7373
}
7474

7575
/**
7676
* @param string $url
7777
*/
78-
public function seeRedirectTo($url)
78+
public function seeRedirectTo(string $url): void
7979
{
8080
if ($this->client->isFollowingRedirects()) {
8181
$this->fail('Method seeRedirectTo only works when followRedirects option is disabled');
@@ -89,7 +89,7 @@ public function seeRedirectTo($url)
8989
}
9090
}
9191

92-
public function debugContent()
92+
public function debugContent(): void
9393
{
9494
$this->debugSection('Content', $this->client->getInternalResponse()->getContent());
9595
}

src/Module/NetteDIModule.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function _after(TestInterface $test)
7878
}
7979
}
8080

81-
public function useConfigFiles(array $configFiles)
81+
public function useConfigFiles(array $configFiles): void
8282
{
8383
if (!$this->config['newContainerForEachTest']) {
8484
$this->fail('The useConfigFiles can only be used if the newContainerForEachTest option is set to true.');
@@ -92,7 +92,7 @@ public function useConfigFiles(array $configFiles)
9292
/**
9393
* @return Container
9494
*/
95-
public function getContainer()
95+
public function getContainer(): Container
9696
{
9797
if (!$this->container) {
9898
$this->createContainer();
@@ -106,7 +106,7 @@ public function getContainer()
106106
*
107107
* @return object
108108
*/
109-
public function grabService($service)
109+
public function grabService(string $service)
110110
{
111111
try {
112112
return $this->getContainer()->getByType($service);
@@ -115,7 +115,7 @@ public function grabService($service)
115115
}
116116
}
117117

118-
private function createContainer()
118+
private function createContainer(): void
119119
{
120120
$configurator = new Configurator();
121121
if ($this->config['removeDefaultExtensions']) {

tests/functional/src/Fixtures/RouterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class RouterFactory extends Object
1717
/**
1818
* @return IRouter
1919
*/
20-
public function create()
20+
public function create(): IRouter
2121
{
2222
$router = new RouteList();
2323
$router[] = new Route('<presenter>[/<action>[/<id>]]', 'Homepage:default');

0 commit comments

Comments
 (0)