Skip to content

Commit

Permalink
phpstan level 4
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Jan 3, 2025
1 parent 0ea6844 commit fd48954
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:

jobs:
phpstan-src:
name: PHPStan src
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Pull in optional dependencies
run: composer require --no-update phpunit/phpunit toflar/psr6-symfony-http-cache-store:^4.2 symfony/process phpstan/phpstan-mockery
run: composer require --no-update phpunit/phpunit toflar/psr6-symfony-http-cache-store:^4.2 symfony/process mockery/mockery phpstan/phpstan-mockery guzzlehttp/guzzle php-http/mock-client

- name: Cache Vendor
id: cache-vendor
Expand Down
3 changes: 1 addition & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ parameters:
- src
- tests

includes:
- vendor/phpstan/phpstan-mockery/extension.neon
treatPhpDocTypesAsCertain: false
6 changes: 4 additions & 2 deletions src/ProxyClient/MultiplexerClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function clear(): static
* Invoke the given $method on all available ProxyClients implementing the
* given $interface.
*
* @param string $interface The FQN of the interface
* @param class-string $interface The FQN of the interface
* @param string $method The method to invoke
* @param array<mixed> $arguments The arguments to be passed to the method
*/
Expand All @@ -155,7 +155,9 @@ private function getProxyClients(string $interface): array
{
return array_filter(
$this->proxyClients,
static function ($proxyClient) use ($interface) {
static function (ProxyClient $proxyClient) use ($interface) {
// https://github.com/phpstan/phpstan/issues/8464
// @phpstan-ignore-next-line
return is_subclass_of($proxyClient, $interface);
}
);
Expand Down
2 changes: 0 additions & 2 deletions src/Test/WebServerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ private function hasTestsWithGroup(TestSuite $testSuite, string $group): bool
continue;
}

assert($test instanceof TestMethod);

foreach ($test->metadata()->isGroup() as $testGroup) {
assert($testGroup instanceof Group);

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/ProxyClient/NginxProxyClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testPurgeContentType(): void
{
$this->markTestSkipped('Not working with nginx, it can only purge one type');

$this->assertPurgeContentType($this->getProxyClient());
// $this->assertPurgeContentType($this->getProxyClient());
}

public function testPurgeSeparateLocationHost(): void
Expand All @@ -57,6 +57,6 @@ public function testRefreshContentType(): void
{
$this->markTestSkipped('TODO: is nginx mixing up variants?');

$this->assertRefreshContentType($this->getProxyClient());
// $this->assertRefreshContentType($this->getProxyClient());
}
}
3 changes: 1 addition & 2 deletions tests/Unit/SymfonyCache/KernelDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public function testFlush(): void
->with($this->callback(function (Request $request) {
// Test if the Symfony request contains the relevant information
// from the PSR-7 request
$valid = true;
$valid = $valid && 'PURGETAGS' === $request->getMethod();
$valid = 'PURGETAGS' === $request->getMethod();
$valid = $valid && 'foobar' === $request->headers->get('content-type');
$valid = $valid && 'foo,bar,stuff' === $request->headers->get('x-cache-tags');
$valid = $valid && ['query' => 'string', 'more' => 'stuff'] === $request->query->all();
Expand Down

0 comments on commit fd48954

Please sign in to comment.