From ff70a0bc08a1585a5cdbe1a5d3c79d6e11989af5 Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 26 Nov 2026 09:51:44 +0100 Subject: [PATCH 1/6] refactor(types): analyse ArgumentHelper instead of baselining its being unused PHPStan skips a trait that no analysed class uses, so nothing in src was analysed. The class the tests use moves to tests/Fixtures, which joins the analysed paths; the baseline is no longer included. The one real report, an unknown type in a @var, is fixed. --- phpstan.neon | 3 +- src/ArgumentHelper.php | 2 +- tests/Feature/ArgumentHelperTest.php | 35 +--------------------- tests/Fixtures/TestClass.php | 43 ++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 36 deletions(-) create mode 100644 tests/Fixtures/TestClass.php diff --git a/phpstan.neon b/phpstan.neon index 78b4d7d..2617850 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,8 @@ includes: - - phpstan-baseline.neon - vendor/pollora/harness/presets/phpstan/base.neon parameters: level: 5 paths: - src + # PHPStan skips a trait no analysed class uses: this class makes it analyse ArgumentHelper + - tests/Fixtures diff --git a/src/ArgumentHelper.php b/src/ArgumentHelper.php index 3daa3e0..344997e 100644 --- a/src/ArgumentHelper.php +++ b/src/ArgumentHelper.php @@ -14,7 +14,7 @@ trait ArgumentHelper /** * Raw post type args. * - * @var args + * @var array|null */ private $rawArgs; diff --git a/tests/Feature/ArgumentHelperTest.php b/tests/Feature/ArgumentHelperTest.php index 833208a..56d2e2b 100644 --- a/tests/Feature/ArgumentHelperTest.php +++ b/tests/Feature/ArgumentHelperTest.php @@ -2,40 +2,7 @@ declare(strict_types=1); -use Pollora\WordPressArgs\ArgumentHelper; - -class TestClass -{ - use ArgumentHelper; - - private $testProperty; - - private $anotherProperty; - - public function getTestProperty() - { - return $this->testProperty; - } - - public function setTestProperty($value) - { - $this->testProperty = $value; - - return $this; - } - - public function getAnotherProperty() - { - return $this->anotherProperty; - } - - public function setAnotherProperty($value) - { - $this->anotherProperty = $value; - - return $this; - } -} +require_once __DIR__.'/../Fixtures/TestClass.php'; test('extractArgumentFromProperties correctly extracts arguments', function () { $testObject = new TestClass; diff --git a/tests/Fixtures/TestClass.php b/tests/Fixtures/TestClass.php new file mode 100644 index 0000000..795b8ef --- /dev/null +++ b/tests/Fixtures/TestClass.php @@ -0,0 +1,43 @@ +testProperty; + } + + public function setTestProperty(string $value): self + { + $this->testProperty = $value; + + return $this; + } + + public function getAnotherProperty(): ?string + { + return $this->anotherProperty; + } + + public function setAnotherProperty(string $value): self + { + $this->anotherProperty = $value; + + return $this; + } +} From 22753ecc8b878613f65cfce1884cd04a2f3f6a8f Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 26 Nov 2026 09:52:36 +0100 Subject: [PATCH 2/6] refactor(types): analyse at PHPStan level 6 Value types of the arrays of ArgumentHelper, in PHPDoc only. --- .harness.json | 4 ++-- phpstan.neon | 2 +- src/ArgumentHelper.php | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.harness.json b/.harness.json index c8be860..1d39e1e 100644 --- a/.harness.json +++ b/.harness.json @@ -8,10 +8,10 @@ "illuminate/support" ], "ratchet": { - "type_coverage": 88.8, - "phpstan_level": 5, + "phpstan_level": 6, "phpstan_baseline": 1, "coverage": 100, + "type_coverage": 88.8, "msi": 85 } } diff --git a/phpstan.neon b/phpstan.neon index 2617850..e294722 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ includes: - vendor/pollora/harness/presets/phpstan/base.neon parameters: - level: 5 + level: 6 paths: - src # PHPStan skips a trait no analysed class uses: this class makes it analyse ArgumentHelper diff --git a/src/ArgumentHelper.php b/src/ArgumentHelper.php index 344997e..6d6f2c2 100644 --- a/src/ArgumentHelper.php +++ b/src/ArgumentHelper.php @@ -21,7 +21,7 @@ trait ArgumentHelper /** * Set the raw arguments for the method. * - * @param array $rawArgs The raw arguments to be set. + * @param array $rawArgs The raw arguments to be set. * @return self Returns the instance of the object for method chaining. */ public function setRawArgs(array $rawArgs): self @@ -34,7 +34,7 @@ public function setRawArgs(array $rawArgs): self /** * Get the raw arguments * - * @return array|null The raw arguments, or null if not set + * @return array|null The raw arguments, or null if not set */ public function getRawArgs(): ?array { @@ -44,7 +44,7 @@ public function getRawArgs(): ?array /** * Extracts arguments from object properties using getter methods. * - * @return array An associative array containing the extracted arguments. + * @return array An associative array containing the extracted arguments. */ public function extractArgumentFromProperties(): array { @@ -66,7 +66,7 @@ public function extractArgumentFromProperties(): array /** * Build the arguments array * - * @return array The built arguments array + * @return array The built arguments array */ protected function buildArguments(): array { @@ -78,7 +78,7 @@ protected function buildArguments(): array /** * Collects all getter methods of the current object. * - * @return array An array containing all getter method names. + * @return array An array containing all getter method names. */ private function collectGetters(): array { From 51746dc79c7778d81e5fb501c44933d47c2edb3a Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 26 Nov 2026 09:52:38 +0100 Subject: [PATCH 3/6] refactor(types): analyse at PHPStan level 7 No code change needed. --- .harness.json | 2 +- phpstan.neon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.harness.json b/.harness.json index 1d39e1e..6fc7d83 100644 --- a/.harness.json +++ b/.harness.json @@ -8,7 +8,7 @@ "illuminate/support" ], "ratchet": { - "phpstan_level": 6, + "phpstan_level": 7, "phpstan_baseline": 1, "coverage": 100, "type_coverage": 88.8, diff --git a/phpstan.neon b/phpstan.neon index e294722..373cc43 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ includes: - vendor/pollora/harness/presets/phpstan/base.neon parameters: - level: 6 + level: 7 paths: - src # PHPStan skips a trait no analysed class uses: this class makes it analyse ArgumentHelper From 783f29df3311060b8001f24fb5edd87c04bfe67f Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 26 Nov 2026 09:52:40 +0100 Subject: [PATCH 4/6] refactor(types): analyse at PHPStan level 8 No code change needed. --- .harness.json | 2 +- phpstan.neon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.harness.json b/.harness.json index 6fc7d83..8bb60fe 100644 --- a/.harness.json +++ b/.harness.json @@ -8,7 +8,7 @@ "illuminate/support" ], "ratchet": { - "phpstan_level": 7, + "phpstan_level": 8, "phpstan_baseline": 1, "coverage": 100, "type_coverage": 88.8, diff --git a/phpstan.neon b/phpstan.neon index 373cc43..c333cc6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ includes: - vendor/pollora/harness/presets/phpstan/base.neon parameters: - level: 7 + level: 8 paths: - src # PHPStan skips a trait no analysed class uses: this class makes it analyse ArgumentHelper From 0d9cc5e1ebcac1859372c1c69209b2ea3008b746 Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 26 Nov 2026 09:52:43 +0100 Subject: [PATCH 5/6] refactor(types): analyse at PHPStan level 9 No code change needed. --- .harness.json | 2 +- phpstan.neon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.harness.json b/.harness.json index 8bb60fe..6599d80 100644 --- a/.harness.json +++ b/.harness.json @@ -8,7 +8,7 @@ "illuminate/support" ], "ratchet": { - "phpstan_level": 8, + "phpstan_level": 9, "phpstan_baseline": 1, "coverage": 100, "type_coverage": 88.8, diff --git a/phpstan.neon b/phpstan.neon index c333cc6..0ec3086 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ includes: - vendor/pollora/harness/presets/phpstan/base.neon parameters: - level: 8 + level: 9 paths: - src # PHPStan skips a trait no analysed class uses: this class makes it analyse ArgumentHelper From 09b2ac90c13b086175907b2e191394ffd0b23680 Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 26 Nov 2026 09:52:46 +0100 Subject: [PATCH 6/6] refactor(types): analyse at PHPStan level 10 No code change needed beyond the PHPDoc of level 6. --- .harness.json | 2 +- phpstan.neon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.harness.json b/.harness.json index 6599d80..69f5541 100644 --- a/.harness.json +++ b/.harness.json @@ -8,7 +8,7 @@ "illuminate/support" ], "ratchet": { - "phpstan_level": 9, + "phpstan_level": "max", "phpstan_baseline": 1, "coverage": 100, "type_coverage": 88.8, diff --git a/phpstan.neon b/phpstan.neon index 0ec3086..511a565 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ includes: - vendor/pollora/harness/presets/phpstan/base.neon parameters: - level: 9 + level: 10 paths: - src # PHPStan skips a trait no analysed class uses: this class makes it analyse ArgumentHelper