Skip to content

Commit 0952653

Browse files
committed
Increase PHPStan level
1 parent ec89836 commit 0952653

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727
"facile-it/facile-coding-standard": "^0.3.1",
2828
"jangregor/phpstan-prophecy": "^0.6.2",
2929
"php-coveralls/php-coveralls": "^2.1",
30+
"phpstan/extension-installer": "^1.0",
3031
"phpstan/phpstan": "^0.12.18",
3132
"phpstan/phpstan-phpunit": "^0.12.6",
3233
"phpunit/phpunit": "^7.5.20|^8.5.2",
3334
"symfony/browser-kit": "^3.4|^4.0|^5.0",
34-
"symfony/monolog-bundle": "^3.0",
3535
"symfony/monolog-bridge": ">=3",
36+
"symfony/monolog-bundle": "^3.0",
3637
"symfony/phpunit-bridge": "^5.0",
3738
"symfony/security-bundle": "^3.4|^4.0|^5.0",
3839
"symfony/security-core": "^3.4|^4.0|^5.0"

phpstan-baseline.neon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Array \\(array\\<Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\>\\) does not accept object\\|null\\.$#"
5+
count: 1
6+
path: src/WebTestCase.php
7+
8+
-
9+
message: "#^Method Facile\\\\SymfonyFunctionalTestCase\\\\WebTestCase\\:\\:getContainer\\(\\) should return Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface but returns object\\|null\\.$#"
10+
count: 1
11+
path: src/WebTestCase.php
12+
13+
-
14+
message: "#^Parameter \\#1 \\$callable of static method Doctrine\\\\Common\\\\Annotations\\\\AnnotationRegistry\\:\\:registerLoader\\(\\) expects callable\\(\\)\\: mixed, array\\(mixed, 'loadClass'\\) given\\.$#"
15+
count: 1
16+
path: tests/App/bootstrap.php

phpstan.neon

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
2-
level: 0
5+
level: 8
36
paths:
47
- src
58
- tests

src/WebTestCase.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Symfony\Component\Console\Tester\CommandTester;
1111
use Symfony\Component\DependencyInjection\ContainerInterface;
1212
use Symfony\Component\HttpFoundation\Response;
13+
use Symfony\Component\HttpKernel\KernelInterface;
1314

1415
if (! class_exists(KernelBrowser::class)) {
1516
\class_alias(\Symfony\Bundle\FrameworkBundle\Client::class, KernelBrowser::class);
@@ -25,6 +26,7 @@ abstract class WebTestCase extends BaseWebTestCase
2526

2627
/**
2728
* Builds up the environment to run the given command.
29+
* @param array<string, mixed> $params
2830
*/
2931
protected function runCommand(string $name, array $params = [], bool $reuseKernel = false): CommandTester
3032
{
@@ -36,6 +38,7 @@ protected function runCommand(string $name, array $params = [], bool $reuseKerne
3638
$kernel = static::$kernel = static::createKernel(['environment' => $this->environment]);
3739
$kernel->boot();
3840
} else {
41+
/** @var KernelInterface $kernel */
3942
$kernel = $this->getContainer()->get('kernel');
4043
}
4144

tests/App/AppKernel.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
namespace Facile\SymfonyFunctionalTestCase\Tests\App;
66

77
use Symfony\Component\Config\Loader\LoaderInterface;
8+
use Symfony\Component\HttpKernel\Bundle\Bundle;
89
use Symfony\Component\HttpKernel\Kernel;
910

1011
class AppKernel extends Kernel
1112
{
13+
/**
14+
* @return Bundle[]
15+
*/
1216
public function registerBundles(): array
1317
{
1418
$bundles = [

tests/WebTestCaseTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public function testIndex(): void
4040
$this->assertStatusCodeIsSuccessful($client);
4141
$response = $client->getResponse();
4242
$this->assertInstanceOf(Response::class, $response);
43-
$this->assertStringContainsString('Hello world', $response->getContent());
43+
$content = $response->getContent();
44+
$this->assertIsString($content);
45+
$this->assertStringContainsString('Hello world', $content);
4446
}
4547

4648
/**

0 commit comments

Comments
 (0)