Skip to content

Commit f20b95f

Browse files
committed
add phpcs PSR12 + phpstan doctrine extension
1 parent 17224c1 commit f20b95f

9 files changed

+366
-4
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@
2121
###> symfony/web-server-bundle ###
2222
/.web-server-pid
2323
###< symfony/web-server-bundle ###
24+
25+
###> squizlabs/php_codesniffer ###
26+
/.phpcs-cache
27+
/phpcs.xml
28+
###< squizlabs/php_codesniffer ###

.vscode/extensions.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"felixfbecker.php-debug",
44
"bmewburn.vscode-intelephense-client",
55
"levacic.vscode-phpstan",
6-
"st-pham.php-refactor-tool"
6+
"st-pham.php-refactor-tool",
7+
"wongjn.php-sniffer"
78
]
89
}

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Alternatives names could be *Argali* or *Urial* as it refers to *Gazelle*, the m
1212

1313
composer check
1414

15+
### Fix basic check errors
16+
17+
composer fix
18+
1519
### Run the dev server
1620

1721
bin/console server:start

build/doctrine-loader.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types = 1);
2+
3+
use App\Kernel;
4+
use Symfony\Component\Dotenv\Dotenv;
5+
6+
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
7+
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
8+
$kernel->boot();
9+
return $kernel->getContainer()->get('doctrine')->getManager();

composer.json

+8
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@
5454
"doctrine/doctrine-fixtures-bundle": "^3.4",
5555
"phpstan/phpstan": "^0.12.65",
5656
"phpstan/phpstan-deprecation-rules": "^0.12.6",
57+
"phpstan/phpstan-doctrine": "^0.12.26",
5758
"phpstan/phpstan-phpunit": "^0.12.17",
5859
"phpstan/phpstan-symfony": "^0.12.12",
60+
"squizlabs/php_codesniffer": "^3.5",
5961
"symfony/browser-kit": "^5.2",
6062
"symfony/css-selector": "^5.2",
6163
"symfony/debug-bundle": "^5.2",
@@ -94,6 +96,7 @@
9496
"assets:install %PUBLIC_DIR%": "symfony-cmd"
9597
},
9698
"check": [
99+
"@phpcs",
97100
"@phpstan",
98101
"@check-symfony"
99102
],
@@ -102,6 +105,11 @@
102105
"@php bin/console --ansi lint:twig",
103106
"@php bin/console --ansi doctrine:schema:validate --skip-sync"
104107
],
108+
"fix": [
109+
"@phpcbf"
110+
],
111+
"phpcs": "phpcs --runtime-set ignore_warnings_on_exit 1",
112+
"phpcbf": "phpcbf",
105113
"phpstan": [
106114
"@php bin/console cache:warmup -q",
107115
"phpstan analyse --ansi"

0 commit comments

Comments
 (0)