From 00cc67d77c8f1668465ffd6a265ba532ffbbc686 Mon Sep 17 00:00:00 2001 From: nukisashineko Date: Sun, 26 Jan 2025 13:41:32 +0900 Subject: [PATCH 1/2] add php version 8.2 ~ 8.4 to strategy matrix --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 4a97b83d9b8e1d32f7e9419feb701fba2035f771 Mon Sep 17 00:00:00 2001 From: nukisashineko Date: Sun, 26 Jan 2025 14:36:18 +0900 Subject: [PATCH 2/2] change type to be specific nullable for rfc/deprecate-implicitly-nullable-types --- src/Codeception/Specify.php | 12 ++++++------ src/Codeception/Specify/SpecifyHooks.php | 6 +++--- src/Codeception/Specify/SpecifyTest.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) 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);