From 1d4e5139920a3e6f8d20b8cedebd3afc8761bbe1 Mon Sep 17 00:00:00 2001 From: ebln <34722048+ebln@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:32:00 +0200 Subject: [PATCH] Remove debug artifacts and fix code PHPStan yells at `Attribute class INVALID\NOT\FOUND\ATTRIBUTE does not exist.` --- phpstan.neon | 9 --------- tests/dataAttrib/LoopholeFactory.php | 4 ++-- tests/dataAttrib/LoopholeInvoker.php | 4 ++-- .../dataAttrib/code/IndependentForcedFactoryProduct.php | 1 - 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 2e7645a..6699c65 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,12 +6,3 @@ parameters: paths: - src - tests - - excludePaths: - analyseAndScan: - - tests/data/* - - tests/dataAttrib/* - - tests/dataMixed/* - -rules: - - \Ebln\PHPStan\EnforceFactory\ForceFactoryRule diff --git a/tests/dataAttrib/LoopholeFactory.php b/tests/dataAttrib/LoopholeFactory.php index 912c0cf..b41f714 100644 --- a/tests/dataAttrib/LoopholeFactory.php +++ b/tests/dataAttrib/LoopholeFactory.php @@ -6,7 +6,7 @@ class LoopholeFactory { - public function variableUninferable(bool $toggle): void + public function variableUninferable(bool $toggle): object { if ($toggle) { $class = '\Test\Ebln\PHPStan\EnforceFactory\dataAttrib\code\LoopholeProduct'; @@ -14,6 +14,6 @@ public function variableUninferable(bool $toggle): void $class = 'Hello world-' . random_int(10, 99); } - $new = new $class(); + return new $class(); } } diff --git a/tests/dataAttrib/LoopholeInvoker.php b/tests/dataAttrib/LoopholeInvoker.php index f4d708c..fff9c91 100644 --- a/tests/dataAttrib/LoopholeInvoker.php +++ b/tests/dataAttrib/LoopholeInvoker.php @@ -20,8 +20,8 @@ public function expectedFailingLoophole(): object return $loophole; } - public function expectedMissingClass() + public function expectedMissingClass(): void { - return $this->loopholeFactory->variableUninferable(false); + $this->loopholeFactory->variableUninferable(false); } } diff --git a/tests/dataAttrib/code/IndependentForcedFactoryProduct.php b/tests/dataAttrib/code/IndependentForcedFactoryProduct.php index 9a7acf7..a125fa8 100644 --- a/tests/dataAttrib/code/IndependentForcedFactoryProduct.php +++ b/tests/dataAttrib/code/IndependentForcedFactoryProduct.php @@ -7,7 +7,6 @@ use Test\Ebln\PHPStan\EnforceFactory\dataAttrib\IndependentFactory; #[\Ebln\Attrib\ForceFactory(IndependentFactory::class)] -#[\INVALID\NOT\FOUND\ATTRIBUTE(IndependentFactory::class)] class IndependentForcedFactoryProduct { }