Skip to content

Commit 4a97b83

Browse files
committed
change type to be specific nullable for rfc/deprecate-implicitly-nullable-types
1 parent 00cc67d commit 4a97b83

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/Codeception/Specify.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait Specify
1717
getCurrentSpecifyTest as public;
1818
}
1919

20-
public function specify(string $thing, Closure $code = null, $examples = []): ?self
20+
public function specify(string $thing, ?Closure $code = null, $examples = []): ?self
2121
{
2222
if ($code instanceof Closure) {
2323
$this->runSpec($thing, $code, $examples);
@@ -27,7 +27,7 @@ public function specify(string $thing, Closure $code = null, $examples = []): ?s
2727
return $this;
2828
}
2929

30-
public function describe(string $feature, Closure $code = null): ?self
30+
public function describe(string $feature, ?Closure $code = null): ?self
3131
{
3232
if ($code instanceof Closure) {
3333
$this->runSpec($feature, $code);
@@ -37,7 +37,7 @@ public function describe(string $feature, Closure $code = null): ?self
3737
return $this;
3838
}
3939

40-
public function it(string $specification, Closure $code = null, $examples = []): self
40+
public function it(string $specification, ?Closure $code = null, $examples = []): self
4141
{
4242
if ($code instanceof Closure) {
4343
$this->runSpec($specification, $code, $examples);
@@ -48,12 +48,12 @@ public function it(string $specification, Closure $code = null, $examples = []):
4848
return $this;
4949
}
5050

51-
public function its(string $specification, Closure $code = null, $examples = []): self
51+
public function its(string $specification, ?Closure $code = null, $examples = []): self
5252
{
5353
return $this->it($specification, $code, $examples);
5454
}
5555

56-
public function should(string $behavior, Closure $code = null, $examples = []): self
56+
public function should(string $behavior, ?Closure $code = null, $examples = []): self
5757
{
5858
if ($code instanceof Closure) {
5959
$this->runSpec('should ' . $behavior, $code, $examples);
@@ -64,7 +64,7 @@ public function should(string $behavior, Closure $code = null, $examples = []):
6464
return $this;
6565
}
6666

67-
public function shouldNot(string $behavior, Closure $code = null, $examples = []): self
67+
public function shouldNot(string $behavior, ?Closure $code = null, $examples = []): self
6868
{
6969
if ($code instanceof Closure) {
7070
$this->runSpec('should not ' . $behavior, $code, $examples);

src/Codeception/Specify/SpecifyHooks.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private function getCurrentSpecifyTest(): SpecifyTest
3535
* @param Closure|null $callable
3636
* @param callable|array $params
3737
*/
38-
private function runSpec(string $specification, Closure $callable = null, $params = [])
38+
private function runSpec(string $specification, ?Closure $callable = null, $params = [])
3939
{
4040
if ($callable === null) {
4141
return;
@@ -204,12 +204,12 @@ private function specifyCloneProperties(array $properties)
204204
}
205205
}
206206

207-
private function beforeSpecify(Closure $callable = null)
207+
private function beforeSpecify(?Closure $callable = null)
208208
{
209209
$this->beforeSpecify[] = $callable->bindTo($this);
210210
}
211211

212-
private function afterSpecify(Closure $callable = null)
212+
private function afterSpecify(?Closure $callable = null)
213213
{
214214
$this->afterSpecify[] = $callable->bindTo($this);
215215
}

src/Codeception/Specify/SpecifyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function count(): int
6565
/**
6666
* Runs a test and collects its result in a TestResult instance.
6767
*/
68-
public function run(TestResult $result = null): TestResult
68+
public function run(?TestResult $result = null): TestResult
6969
{
7070
try {
7171
call_user_func_array($this->test, $this->example);

0 commit comments

Comments
 (0)