Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Larastan to level 5 #101

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ includes:
- vendor/phpstan/phpstan-phpunit/rules.neon

parameters:
level: 4
level: 5

paths:
- config
Expand All @@ -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
4 changes: 2 additions & 2 deletions src/AppHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AppHealth
{
public function __construct(
/**
* @var Collection<int, HealthCheck>
* @var Collection<int, covariant HealthCheck>
*/
protected Collection $checks,
) {
Expand Down Expand Up @@ -40,7 +40,7 @@ public function fails($checkName): bool
/**
* Returns a collection of all health checks
*
* @return Collection<int, HealthCheck>
* @return Collection<int, covariant HealthCheck>
*/
public function all(): Collection
{
Expand Down
4 changes: 2 additions & 2 deletions src/Checks/HttpHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function status(): Status
$badConnections = collect();

/**
* @var Collection<string, string> $generalFailures
* @var Collection<string, array<string|int|array>> $generalFailures
*/
$generalFailures = collect();

Expand Down Expand Up @@ -80,7 +80,7 @@ public function status(): Status
/**
* @param Collection<string, array<string, string>> $badResponses
* @param Collection<string, string> $badConnections
* @param Collection<string, string> $generalFailures
* @param Collection<string, array<string|int|array>> $generalFailures
*/
private function isOkay(Collection $badResponses, Collection $badConnections, Collection $generalFailures): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/Checks/PackageSecurityHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
2 changes: 1 addition & 1 deletion tests/Checks/CrossServiceHealthCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 5 additions & 6 deletions tests/Checks/FtpHealthCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down