Skip to content

Commit 9a512a8

Browse files
committed
Add Symfony and Doctrine PHPStan extensions
1 parent 1391d41 commit 9a512a8

File tree

6 files changed

+194
-10
lines changed

6 files changed

+194
-10
lines changed

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
"require-dev": {
5050
"dama/doctrine-test-bundle": "^7.0",
5151
"doctrine/doctrine-fixtures-bundle": "^3.4",
52+
"phpstan/extension-installer": "^1.2",
5253
"phpstan/phpstan": "^1.2",
54+
"phpstan/phpstan-doctrine": "^1.3",
55+
"phpstan/phpstan-symfony": "^1.2",
5356
"symfony/browser-kit": "^6.2",
5457
"symfony/css-selector": "^6.2",
5558
"symfony/debug-bundle": "^6.2",
@@ -61,7 +64,8 @@
6164
"config": {
6265
"allow-plugins": {
6366
"symfony/flex": true,
64-
"symfony/runtime": true
67+
"symfony/runtime": true,
68+
"phpstan/extension-installer": true
6569
},
6670
"platform": {
6771
"php": "8.1.0"

composer.lock

Lines changed: 185 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/services.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,3 @@ services:
3434
$sender: '%app.notifications.email_sender%'
3535

3636
Symfony\Component\Security\Http\Logout\LogoutUrlGenerator: '@security.logout_url_generator'
37-
38-
when@test:
39-
services:
40-
test.user_password_hasher:
41-
alias: 'security.user_password_hasher'
42-
public: true

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ parameters:
88
- tests
99
bootstrapFiles:
1010
- vendor/bin/.phpunit/phpunit/vendor/autoload.php
11+
symfony:
12+
containerXmlPath: var/cache/dev/App_KernelDevDebugContainer.xml

src/Controller/BlogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function commentForm(Post $post): Response
156156
public function search(Request $request, PostRepository $posts): Response
157157
{
158158
$query = (string) $request->query->get('q', '');
159-
$limit = (int) $request->query->get('l', 10);
159+
$limit = $request->query->getInt('l', 10);
160160

161161
if (!$request->isXmlHttpRequest()) {
162162
return $this->render('blog/search.html.twig', ['query' => $query]);

tests/Command/AddUserCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function assertUserCreated(bool $isAdmin): void
9292
$repository = $this->getContainer()->get(UserRepository::class);
9393

9494
/** @var UserPasswordHasherInterface $passwordHasher */
95-
$passwordHasher = $this->getContainer()->get('test.user_password_hasher');
95+
$passwordHasher = $this->getContainer()->get(UserPasswordHasherInterface::class);
9696

9797
$user = $repository->findOneByEmail($this->userData['email']);
9898

0 commit comments

Comments
 (0)