diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6f7f5d..aa83614 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - php: [7.4, 8.0, 8.1] + php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4] steps: - name: Checkout code diff --git a/src/Codeception/Specify.php b/src/Codeception/Specify.php index 72d49f0..9381f57 100644 --- a/src/Codeception/Specify.php +++ b/src/Codeception/Specify.php @@ -17,7 +17,7 @@ trait Specify getCurrentSpecifyTest as public; } - public function specify(string $thing, Closure $code = null, $examples = []): ?self + public function specify(string $thing, ?Closure $code = null, $examples = []): ?self { if ($code instanceof Closure) { $this->runSpec($thing, $code, $examples); @@ -27,7 +27,7 @@ public function specify(string $thing, Closure $code = null, $examples = []): ?s return $this; } - public function describe(string $feature, Closure $code = null): ?self + public function describe(string $feature, ?Closure $code = null): ?self { if ($code instanceof Closure) { $this->runSpec($feature, $code); @@ -37,7 +37,7 @@ public function describe(string $feature, Closure $code = null): ?self return $this; } - public function it(string $specification, Closure $code = null, $examples = []): self + public function it(string $specification, ?Closure $code = null, $examples = []): self { if ($code instanceof Closure) { $this->runSpec($specification, $code, $examples); @@ -48,12 +48,12 @@ public function it(string $specification, Closure $code = null, $examples = []): return $this; } - public function its(string $specification, Closure $code = null, $examples = []): self + public function its(string $specification, ?Closure $code = null, $examples = []): self { return $this->it($specification, $code, $examples); } - public function should(string $behavior, Closure $code = null, $examples = []): self + public function should(string $behavior, ?Closure $code = null, $examples = []): self { if ($code instanceof Closure) { $this->runSpec('should ' . $behavior, $code, $examples); @@ -64,7 +64,7 @@ public function should(string $behavior, Closure $code = null, $examples = []): return $this; } - public function shouldNot(string $behavior, Closure $code = null, $examples = []): self + public function shouldNot(string $behavior, ?Closure $code = null, $examples = []): self { if ($code instanceof Closure) { $this->runSpec('should not ' . $behavior, $code, $examples); diff --git a/src/Codeception/Specify/SpecifyHooks.php b/src/Codeception/Specify/SpecifyHooks.php index d84d5c9..8928a97 100644 --- a/src/Codeception/Specify/SpecifyHooks.php +++ b/src/Codeception/Specify/SpecifyHooks.php @@ -35,7 +35,7 @@ private function getCurrentSpecifyTest(): SpecifyTest * @param Closure|null $callable * @param callable|array $params */ - private function runSpec(string $specification, Closure $callable = null, $params = []) + private function runSpec(string $specification, ?Closure $callable = null, $params = []) { if ($callable === null) { return; @@ -204,12 +204,12 @@ private function specifyCloneProperties(array $properties) } } - private function beforeSpecify(Closure $callable = null) + private function beforeSpecify(?Closure $callable = null) { $this->beforeSpecify[] = $callable->bindTo($this); } - private function afterSpecify(Closure $callable = null) + private function afterSpecify(?Closure $callable = null) { $this->afterSpecify[] = $callable->bindTo($this); } diff --git a/src/Codeception/Specify/SpecifyTest.php b/src/Codeception/Specify/SpecifyTest.php index 57522ba..9042b2e 100644 --- a/src/Codeception/Specify/SpecifyTest.php +++ b/src/Codeception/Specify/SpecifyTest.php @@ -65,7 +65,7 @@ public function count(): int /** * Runs a test and collects its result in a TestResult instance. */ - public function run(TestResult $result = null): TestResult + public function run(?TestResult $result = null): TestResult { try { call_user_func_array($this->test, $this->example);