chore: major code cleanup and type safety using phpstan

This commit is contained in:
Björn Fromme committed 2026-04-16 17:11:16 +02:00
1 parent 060cbea9da
commit 3da73d626b
103 files changed
+976 -1192

No files matched your search

+11 -11
View File
@@ -24,7 +24,7 @@ class ErrorCodeGeneratorTest extends TestCase
{
$result = $this->service->getErrorCode();
$this->assertNull($result);
self::assertNull($result);
}
public function testReturnsNullWithoutRequestId(): void
@@ -34,7 +34,7 @@ class ErrorCodeGeneratorTest extends TestCase
$result = $this->service->getErrorCode();
$this->assertNull($result);
self::assertNull($result);
}
public function testGeneratesCodeWithRequestId(): void
@@ -45,8 +45,8 @@ class ErrorCodeGeneratorTest extends TestCase
$result = $this->service->getErrorCode();
$this->assertNotNull($result);
$this->assertMatchesRegularExpression('/^E-[A-Z0-9]{8}$/', $result);
self::assertNotNull($result);
self::assertMatchesRegularExpression('/^E-[A-Z0-9]{8}$/', $result);
}
public function testGeneratesConsistentCodeForSameRequestId(): void
@@ -58,7 +58,7 @@ class ErrorCodeGeneratorTest extends TestCase
$result1 = $this->service->getErrorCode();
$result2 = $this->service->getErrorCode();
$this->assertSame($result1, $result2);
self::assertSame($result1, $result2);
}
public function testGeneratesDifferentCodesForDifferentRequestIds(): void
@@ -79,7 +79,7 @@ class ErrorCodeGeneratorTest extends TestCase
$service2 = new ErrorCodeGenerator($this->requestStack);
$result2 = $service2->getErrorCode();
$this->assertNotSame($result1, $result2);
self::assertNotSame($result1, $result2);
}
public function testSequenceSuffixesProduceSameCode(): void
@@ -100,7 +100,7 @@ class ErrorCodeGeneratorTest extends TestCase
$service2 = new ErrorCodeGenerator($this->requestStack);
$result2 = $service2->getErrorCode();
$this->assertSame($result1, $result2);
self::assertSame($result1, $result2);
}
public function testSequenceSuffixMatchesBaseId(): void
@@ -121,19 +121,19 @@ class ErrorCodeGeneratorTest extends TestCase
$service2 = new ErrorCodeGenerator($this->requestStack);
$result2 = $service2->getErrorCode();
$this->assertSame($result1, $result2);
self::assertSame($result1, $result2);
}
public function testHasErrorReturnsFalseByDefault(): void
{
$this->assertFalse($this->service->hasError());
self::assertFalse($this->service->hasError());
}
public function testMarkErrorOccurredSetsFlag(): void
{
$this->service->markErrorOccurred();
$this->assertTrue($this->service->hasError());
self::assertTrue($this->service->hasError());
}
public function testHasErrorRemainsTrueAfterMultipleCalls(): void
@@ -141,6 +141,6 @@ class ErrorCodeGeneratorTest extends TestCase
$this->service->markErrorOccurred();
$this->service->markErrorOccurred();
$this->assertTrue($this->service->hasError());
self::assertTrue($this->service->hasError());
}
}