From bcc9d9966130818447f0c49dd852c0193a2f6318 Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 4 Feb 2026 11:45:27 +0100 Subject: [PATCH] chore: fix PHPStan and Rector errors --- phpstan-baseline.neon | 12 ------------ rector.php | 2 -- src/Format/HTMLFormatter.php | 2 ++ tests/CommonTest.php | 2 ++ tests/Format/HTMLFormatterTest.php | 2 ++ tests/HTTP/IncomingRequestTest.php | 2 ++ tests/HTTP/RedirectResponseTest.php | 2 ++ tests/HTTP/ResponseTest.php | 6 ++++-- tests/View/ErrorModelDecoratorTest.php | 2 ++ tests/View/ToolbarDecoratorTest.php | 2 ++ tests/View/ViewTest.php | 2 ++ 11 files changed, 20 insertions(+), 16 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0747da4..00b7e7c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -27,18 +27,6 @@ parameters: count: 2 path: tests/CodeIgniterTest.php - - - message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''https\://example\.com…'' and ''https\://example\.com…'' will always evaluate to false\.$#' - identifier: method.impossibleType - count: 1 - path: tests/CodeIgniterTest.php - - - - message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''https\://example\.com…'' and ''https\://example\.com…'' will always evaluate to true\.$#' - identifier: method.alreadyNarrowedType - count: 1 - path: tests/CodeIgniterTest.php - - message: ''' #^Call to deprecated method __construct\(\) of class CodeIgniter\\HTTP\\Response\: diff --git a/rector.php b/rector.php index 1e0a31b..b357855 100644 --- a/rector.php +++ b/rector.php @@ -39,7 +39,6 @@ use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; -use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\ValueObject\PhpVersion; @@ -140,7 +139,6 @@ $rectorConfig->rule(StringClassNameToClassConstantRector::class); $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); $rectorConfig->rule(CompleteDynamicPropertiesRector::class); - $rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class); $rectorConfig->rule(SingleInArrayToCompareRector::class); $rectorConfig->rule(VersionCompareFuncCallToConstantRector::class); $rectorConfig->rule(ExplicitBoolCompareRector::class); diff --git a/src/Format/HTMLFormatter.php b/src/Format/HTMLFormatter.php index d7b119c..82531b4 100644 --- a/src/Format/HTMLFormatter.php +++ b/src/Format/HTMLFormatter.php @@ -14,6 +14,8 @@ class HTMLFormatter implements FormatterInterface * Takes the given data and formats it. * * @param array|string|null $data + * + * @phpstan-return string */ public function format($data): string { diff --git a/tests/CommonTest.php b/tests/CommonTest.php index 83c399e..62c573b 100644 --- a/tests/CommonTest.php +++ b/tests/CommonTest.php @@ -1,5 +1,7 @@ response->setPushUrl(null); + $this->response->setPushUrl(); $this->assertSame('false', $this->response->getHeaderLine('HX-Push-Url')); } @@ -44,7 +46,7 @@ public function testSetReplaceUrl(): void public function testSetReplaceUrlFalse(): void { - $this->response->setReplaceUrl(null); + $this->response->setReplaceUrl(); $this->assertSame('false', $this->response->getHeaderLine('HX-Replace-Url')); } diff --git a/tests/View/ErrorModelDecoratorTest.php b/tests/View/ErrorModelDecoratorTest.php index 0bceacf..58a3f72 100644 --- a/tests/View/ErrorModelDecoratorTest.php +++ b/tests/View/ErrorModelDecoratorTest.php @@ -1,5 +1,7 @@