Skip to content

Commit 50de1fa

Browse files
committed
phpstan level 4
1 parent 0ea6844 commit 50de1fa

File tree

9 files changed

+15
-18
lines changed

9 files changed

+15
-18
lines changed

.github/workflows/static.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88

99
jobs:
1010
phpstan-src:
11-
name: PHPStan src
11+
name: PHPStan
1212
runs-on: ubuntu-latest
1313

1414
steps:
1515
- name: Checkout code
1616
uses: actions/checkout@v4
1717

1818
- name: Pull in optional dependencies
19-
run: composer require --no-update phpunit/phpunit toflar/psr6-symfony-http-cache-store:^4.2 symfony/process phpstan/phpstan-mockery
19+
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
2020

2121
- name: Cache Vendor
2222
id: cache-vendor

phpstan.neon.dist

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ parameters:
44
- src
55
- tests
66

7-
includes:
8-
- vendor/phpstan/phpstan-mockery/extension.neon
7+
treatPhpDocTypesAsCertain: false

src/ProxyClient/MultiplexerClient.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function clear(): static
133133
* Invoke the given $method on all available ProxyClients implementing the
134134
* given $interface.
135135
*
136-
* @param string $interface The FQN of the interface
136+
* @param class-string $interface The FQN of the interface
137137
* @param string $method The method to invoke
138138
* @param array<mixed> $arguments The arguments to be passed to the method
139139
*/
@@ -155,7 +155,9 @@ private function getProxyClients(string $interface): array
155155
{
156156
return array_filter(
157157
$this->proxyClients,
158-
static function ($proxyClient) use ($interface) {
158+
static function (ProxyClient $proxyClient) use ($interface) {
159+
// https://github.com/phpstan/phpstan/issues/8464
160+
// @phpstan-ignore-next-line
159161
return is_subclass_of($proxyClient, $interface);
160162
}
161163
);

src/Test/WebServerSubscriber.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\HttpCache\Test;
1313

14-
use PHPUnit\Event\Code\TestMethod;
1514
use PHPUnit\Event\TestRunner\ExecutionStarted;
1615
use PHPUnit\Event\TestRunner\ExecutionStartedSubscriber;
1716
use PHPUnit\Event\TestSuite\TestSuite;
@@ -52,8 +51,6 @@ private function hasTestsWithGroup(TestSuite $testSuite, string $group): bool
5251
continue;
5352
}
5453

55-
assert($test instanceof TestMethod);
56-
5754
foreach ($test->metadata()->isGroup() as $testGroup) {
5855
assert($testGroup instanceof Group);
5956

tests/Functional/ProxyClient/NginxProxyClientTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testPurgeContentType(): void
3535
{
3636
$this->markTestSkipped('Not working with nginx, it can only purge one type');
3737

38-
$this->assertPurgeContentType($this->getProxyClient());
38+
// $this->assertPurgeContentType($this->getProxyClient());
3939
}
4040

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

60-
$this->assertRefreshContentType($this->getProxyClient());
60+
// $this->assertRefreshContentType($this->getProxyClient());
6161
}
6262
}

tests/Unit/SymfonyCache/CacheAwareTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use FOS\HttpCache\SymfonyCache\HttpCacheAware;
1515
use FOS\HttpCache\SymfonyCache\HttpCacheProvider;
1616
use PHPUnit\Framework\TestCase;
17-
use Symfony\Component\HttpKernel\HttpKernelInterface;
17+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1818

1919
class CacheAwareTest extends TestCase
2020
{

tests/Unit/SymfonyCache/KernelDispatcherTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public function testFlush(): void
3333
->with($this->callback(function (Request $request) {
3434
// Test if the Symfony request contains the relevant information
3535
// from the PSR-7 request
36-
$valid = true;
37-
$valid = $valid && 'PURGETAGS' === $request->getMethod();
36+
$valid = 'PURGETAGS' === $request->getMethod();
3837
$valid = $valid && 'foobar' === $request->headers->get('content-type');
3938
$valid = $valid && 'foo,bar,stuff' === $request->headers->get('x-cache-tags');
4039
$valid = $valid && ['query' => 'string', 'more' => 'stuff'] === $request->query->all();

tests/Unit/SymfonyCache/PurgeListenerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function testInvalidConfiguration(): void
188188
private function getKernelMock(StoreInterface $store): MockInterface&CacheInvalidation
189189
{
190190
// https://github.com/phpstan/phpstan-mockery/issues/8
191-
/** @phpstan-ignore-next-line */
191+
/* @phpstan-ignore-next-line */
192192
return \Mockery::mock(CacheInvalidation::class)
193193
->shouldReceive('getStore')
194194
->once()
@@ -199,7 +199,7 @@ private function getKernelMock(StoreInterface $store): MockInterface&CacheInvali
199199
private function getUnusedKernelMock(): CacheInvalidation&MockInterface
200200
{
201201
// https://github.com/phpstan/phpstan-mockery/issues/8
202-
/** @phpstan-ignore-next-line */
202+
/* @phpstan-ignore-next-line */
203203
return \Mockery::mock(CacheInvalidation::class)
204204
->shouldNotReceive('getStore')
205205
->getMock();

tests/Unit/SymfonyCache/PurgeTagsListenerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function testInvalidConfiguration(): void
181181
private function getKernelMock(StoreInterface $store): CacheInvalidation&MockInterface
182182
{
183183
// https://github.com/phpstan/phpstan-mockery/issues/8
184-
/** @phpstan-ignore-next-line */
184+
/* @phpstan-ignore-next-line */
185185
return \Mockery::mock(CacheInvalidation::class)
186186
->shouldReceive('getStore')
187187
->once()
@@ -192,7 +192,7 @@ private function getKernelMock(StoreInterface $store): CacheInvalidation&MockInt
192192
private function getUnusedKernelMock(): CacheInvalidation&MockInterface
193193
{
194194
// https://github.com/phpstan/phpstan-mockery/issues/8
195-
/** @phpstan-ignore-next-line */
195+
/* @phpstan-ignore-next-line */
196196
return \Mockery::mock(CacheInvalidation::class)
197197
->shouldNotReceive('getStore')
198198
->getMock();

0 commit comments

Comments
 (0)