Skip to content

Commit 962501e

Browse files
authored
Fixed implicitly nullable params (#6616)
1 parent 00be472 commit 962501e

File tree

10 files changed

+18
-18
lines changed

10 files changed

+18
-18
lines changed

src/AssertableJsonString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function assertPath($path, $expect)
256256
* @param null|array $responseData
257257
* @return $this
258258
*/
259-
public function assertStructure(array $structure = null, $responseData = null)
259+
public function assertStructure(?array $structure = null, $responseData = null)
260260
{
261261
if (is_null($structure)) {
262262
return $this->assertSimilar($this->decoded);

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Client extends Server
4444

4545
protected string $baseUri = 'http://127.0.0.1/';
4646

47-
public function __construct(ContainerInterface $container, PackerInterface $packer = null, $server = 'http')
47+
public function __construct(ContainerInterface $container, ?PackerInterface $packer = null, $server = 'http')
4848
{
4949
parent::__construct(
5050
$container,

src/Concerns/InteractsWithContainer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function instance($abstract, $instance)
5858
* @param string $abstract
5959
* @return \Mockery\MockInterface
6060
*/
61-
protected function mock($abstract, Closure $mock = null)
61+
protected function mock($abstract, ?Closure $mock = null)
6262
{
6363
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args())));
6464
}
@@ -69,7 +69,7 @@ protected function mock($abstract, Closure $mock = null)
6969
* @param string $abstract
7070
* @return \Mockery\MockInterface
7171
*/
72-
protected function partialMock($abstract, Closure $mock = null)
72+
protected function partialMock($abstract, ?Closure $mock = null)
7373
{
7474
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))->makePartial());
7575
}
@@ -80,7 +80,7 @@ protected function partialMock($abstract, Closure $mock = null)
8080
* @param string $abstract
8181
* @return \Mockery\MockInterface
8282
*/
83-
protected function spy($abstract, Closure $mock = null)
83+
protected function spy($abstract, ?Closure $mock = null)
8484
{
8585
return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args())));
8686
}

src/Fluent/AssertableJson.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AssertableJson implements Arrayable
4545
/**
4646
* Create a new fluent, assertable JSON data instance.
4747
*/
48-
protected function __construct(array $props, string $path = null)
48+
protected function __construct(array $props, ?string $path = null)
4949
{
5050
$this->path = $path;
5151
$this->props = $props;
@@ -148,7 +148,7 @@ protected function dotPath(string $key = ''): string
148148
*
149149
* @return mixed
150150
*/
151-
protected function prop(string $key = null)
151+
protected function prop(?string $key = null)
152152
{
153153
return Arr::get($this->props, $key);
154154
}

src/Fluent/Concerns/Debugging.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait Debugging
1818
*
1919
* @return $this
2020
*/
21-
public function dump(string $prop = null): self
21+
public function dump(?string $prop = null): self
2222
{
2323
dump($this->prop($prop));
2424

@@ -30,7 +30,7 @@ public function dump(string $prop = null): self
3030
*
3131
* @return never
3232
*/
33-
public function dd(string $prop = null): void
33+
public function dd(?string $prop = null): void
3434
{
3535
dd($this->prop($prop));
3636
}
@@ -40,5 +40,5 @@ public function dd(string $prop = null): void
4040
*
4141
* @return mixed
4242
*/
43-
abstract protected function prop(string $key = null);
43+
abstract protected function prop(?string $key = null);
4444
}

src/Fluent/Concerns/Has.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait Has
2323
* @param int|string $key
2424
* @return $this
2525
*/
26-
public function count($key, int $length = null): self
26+
public function count($key, ?int $length = null): self
2727
{
2828
if (is_null($length)) {
2929
$path = $this->dotPath();
@@ -55,7 +55,7 @@ public function count($key, int $length = null): self
5555
* @param null|Closure|int $length
5656
* @return $this
5757
*/
58-
public function has($key, $length = null, Closure $callback = null): self
58+
public function has($key, $length = null, ?Closure $callback = null): self
5959
{
6060
$prop = $this->prop();
6161

@@ -198,7 +198,7 @@ abstract protected function interactsWith(string $key): void;
198198
*
199199
* @return mixed
200200
*/
201-
abstract protected function prop(string $key = null);
201+
abstract protected function prop(?string $key = null);
202202

203203
/**
204204
* Instantiate a new "scope" at the path of the given key.

src/Fluent/Concerns/Interaction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ protected function interactsWith(string $key): void
6666
*
6767
* @return mixed
6868
*/
69-
abstract protected function prop(string $key = null);
69+
abstract protected function prop(?string $key = null);
7070
}

src/Fluent/Concerns/Matching.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function whereContains(string $key, $expected)
198198
* @param null $value
199199
* @return $this
200200
*/
201-
abstract public function has(string $key, $value = null, Closure $scope = null);
201+
abstract public function has(string $key, $value = null, ?Closure $scope = null);
202202

203203
/**
204204
* Ensures that all properties are sorted the same way, recursively.
@@ -228,5 +228,5 @@ abstract protected function dotPath(string $key = ''): string;
228228
*
229229
* @return mixed
230230
*/
231-
abstract protected function prop(string $key = null);
231+
abstract protected function prop(?string $key = null);
232232
}

src/Http/TestResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public function assertJsonMissingPath(string $path)
355355
* @param null|array $responseData
356356
* @return $this
357357
*/
358-
public function assertJsonStructure(array $structure = null, $responseData = null)
358+
public function assertJsonStructure(?array $structure = null, $responseData = null)
359359
{
360360
$this->decodeResponseJson()->assertStructure($structure, $responseData);
361361

src/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HttpClient
2626

2727
protected PackerInterface $packer;
2828

29-
public function __construct(protected ContainerInterface $container, PackerInterface $packer = null, $baseUri = 'http://127.0.0.1:9501')
29+
public function __construct(protected ContainerInterface $container, ?PackerInterface $packer = null, $baseUri = 'http://127.0.0.1:9501')
3030
{
3131
$this->packer = $packer ?? new JsonPacker();
3232
$handler = null;

0 commit comments

Comments
 (0)