diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3c77bd4..0b2540c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,7 +5,7 @@ includes: - vendor/phpstan/phpstan-phpunit/rules.neon parameters: - level: 4 + level: 5 paths: - config @@ -25,6 +25,10 @@ parameters: - tests/Checks/PackageSecurityHealthCheckTest.php - tests/Stubs/Checks/PackageSecurityHealthCheck.php + - message: '#(?:C|c)lass SensioLabs\\Security\\SecurityChecker not found#' + paths: + - src/Checks/PackageSecurityHealthCheck.php + - message: '#Call to method .+ on an unknown class Enlightn\\SecurityChecker\\SecurityChecker#' paths: - src/Checks/PackageSecurityHealthCheck.php diff --git a/src/AppHealth.php b/src/AppHealth.php index e55d2d0..bfce1e7 100644 --- a/src/AppHealth.php +++ b/src/AppHealth.php @@ -10,7 +10,7 @@ class AppHealth { public function __construct( /** - * @var Collection + * @var Collection */ protected Collection $checks, ) { @@ -40,7 +40,7 @@ public function fails($checkName): bool /** * Returns a collection of all health checks * - * @return Collection + * @return Collection */ public function all(): Collection { diff --git a/src/Checks/HttpHealthCheck.php b/src/Checks/HttpHealthCheck.php index 79f15db..07ae9c6 100644 --- a/src/Checks/HttpHealthCheck.php +++ b/src/Checks/HttpHealthCheck.php @@ -34,7 +34,7 @@ public function status(): Status $badConnections = collect(); /** - * @var Collection $generalFailures + * @var Collection> $generalFailures */ $generalFailures = collect(); @@ -80,7 +80,7 @@ public function status(): Status /** * @param Collection> $badResponses * @param Collection $badConnections - * @param Collection $generalFailures + * @param Collection> $generalFailures */ private function isOkay(Collection $badResponses, Collection $badConnections, Collection $generalFailures): bool { diff --git a/src/Checks/PackageSecurityHealthCheck.php b/src/Checks/PackageSecurityHealthCheck.php index ce21090..cfc56aa 100644 --- a/src/Checks/PackageSecurityHealthCheck.php +++ b/src/Checks/PackageSecurityHealthCheck.php @@ -34,7 +34,7 @@ public function status(): Status { try { if (! static::checkDependency(SecurityChecker::class)) { - if (static::checkDependency('SensioLabs\Security\SecurityChecker')) { + if (static::checkDependency(\SensioLabs\Security\SecurityChecker::class)) { throw new Exception( 'The sensiolabs/security-checker package has been archived.' . ' Install enlightn/security-checker instead.' diff --git a/tests/Checks/CrossServiceHealthCheckTest.php b/tests/Checks/CrossServiceHealthCheckTest.php index c305eb8..4079b7b 100644 --- a/tests/Checks/CrossServiceHealthCheckTest.php +++ b/tests/Checks/CrossServiceHealthCheckTest.php @@ -53,7 +53,7 @@ public function testSkipsCheckIfXServiceCheckHeaderIsPresent(): void $container = []; $client = $this->mockClient(new Response(500), $container); $request = Request::create('/'); - $request->headers->set('X-Service-Check', true); + $request->headers->set('X-Service-Check', 'true'); $check = new CrossServiceHealthCheck($client, $request); diff --git a/tests/Checks/FtpHealthCheckTest.php b/tests/Checks/FtpHealthCheckTest.php index 9b09cd2..674075e 100644 --- a/tests/Checks/FtpHealthCheckTest.php +++ b/tests/Checks/FtpHealthCheckTest.php @@ -12,10 +12,9 @@ class FtpHealthCheckTest extends TestCase { public function testShowsProblemWhenCantConnectToFtpServer(): void { - $ftp = Mockery::mock(FtpAdapter::class) - ->expects('listContents') - ->andThrow(new UnableToConnectToFtpHost('uwu')) - ->getMock(); + $ftp = Mockery::mock(FtpAdapter::class); + $ftp->expects('listContents') + ->andThrow(new UnableToConnectToFtpHost('uwu')); $status = (new FtpHealthCheck($ftp))->status(); @@ -32,8 +31,8 @@ public function testShowsOkayWhenCanConnectToFtpServer(): void yield 'baz'; }; - $ftp = Mockery::mock(FtpAdapter::class) - ->expects('listContents') + $ftp = Mockery::mock(FtpAdapter::class); + $ftp->expects('listContents') ->andReturn($generator()) ->getMock();