Skip to content

Commit 4be9861

Browse files
author
dmitriy
committed
refactoring, added additional tools for code quality check, updated POSTMAN collection and docs.
1 parent c68968a commit 4be9861

File tree

321 files changed

+12322
-8378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+12322
-8378
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ DATABASE_LOG_LOGIN_HISTORY_DAYS=90
7777
DATABASE_LOG_REQUEST_HISTORY_DAYS=15
7878

7979
REQUEST_LOG_SENSITIVE_PROPERTIES='["password", "token", "authorization", "cookie"]'
80+
81+
REQUEST_LOG_IGNORED_ROUTES='["", "/", "/api", "/api/", "/api/health", "/api/version", "/api/secret/*"]'

.php_cs.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
return PhpCsFixer\Config::create()
4+
->setRules([
5+
'@Symfony' => true,
6+
'array_syntax' => ['syntax' => 'short'],
7+
])
8+
;

Makefile

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ report-code-coverage: ## update code coverage on coveralls.io. Note: COVERALLS_R
196196

197197
###> phpcs ###
198198
phpcs: ## Run PHP CodeSniffer
199-
@make exec-bash cmd="./vendor/bin/phpcs --version && ./vendor/bin/phpcs --standard=PSR2 --colors -p src"
199+
@make exec-bash cmd="./vendor/bin/phpcs --version && ./vendor/bin/phpcs --standard=PSR2 --colors -p src tests"
200200
###< phpcs ###
201201

202202
###> ecs ###
203203
ecs: ## Run Easy Coding Standard
204-
@make exec-bash cmd="error_reporting=0 ./vendor/bin/ecs --clear-cache check src"
204+
@make exec-bash cmd="error_reporting=0 ./vendor/bin/ecs --clear-cache check src tests"
205205

206206
ecs-fix: ## Run The Easy Coding Standard to fix issues
207-
@make exec-bash cmd="error_reporting=0 ./vendor/bin/ecs --clear-cache --fix check src"
207+
@make exec-bash cmd="error_reporting=0 ./vendor/bin/ecs --clear-cache --fix check src tests"
208208
###< ecs ###
209209

210210
###> phpmetrics ###
@@ -221,3 +221,27 @@ phpmetrics-process: ## Generates PhpMetrics static analysis, should be run insid
221221
@php ./vendor/bin/phpmetrics --version
222222
@./vendor/bin/phpmetrics --junit=reports/junit.xml --report-html=reports/phpmetrics .
223223
###< phpmetrics ###
224+
225+
###> php copy/paste detector ###
226+
phpcpd:
227+
@make exec cmd="php phpcpd.phar --fuzzy src tests"
228+
###< php copy/paste detector ###
229+
230+
###> php mess detector ###
231+
phpmd:
232+
@make exec cmd="php ./vendor/bin/phpmd src text phpmd_ruleset.xml --suffixes php --exclude *src/Migrations/*"
233+
###< php mess detector ###
234+
235+
###> PHPStan static analysis tool ###
236+
phpstan:
237+
@echo "\033[32mRunning PHPStan - PHP Static Analysis Tool\033[39m"
238+
@make exec cmd="bin/console cache:clear --env=test"
239+
@make exec cmd="./vendor/bin/phpstan --version"
240+
@make exec cmd="./vendor/bin/phpstan analyze src tests"
241+
###< PHPStan static analysis tool ###
242+
243+
###> Phpinsights PHP quality checks ###
244+
phpinsights:
245+
@echo "\033[32mRunning PHP Insights\033[39m"
246+
@make exec cmd="php -d error_reporting=0 ./vendor/bin/phpinsights analyse --no-interaction --min-quality=100 --min-complexity=85 --min-architecture=100 --min-style=100"
247+
###< Phpinsights PHP quality checks ###

bin/console

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,33 @@ declare(strict_types = 1);
55
use App\Kernel;
66
use Symfony\Bundle\FrameworkBundle\Console\Application;
77
use Symfony\Component\Console\Input\ArgvInput;
8+
use Symfony\Component\Dotenv\Dotenv;
89
use Symfony\Component\ErrorHandler\Debug;
910

11+
set_time_limit(0);
12+
1013
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
11-
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
14+
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL;
1215
}
1316

14-
set_time_limit(0);
15-
16-
require dirname(__DIR__).'/vendor/autoload.php';
17+
require dirname(__DIR__) . '/vendor/autoload.php';
1718

18-
if (!class_exists(Application::class)) {
19-
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
19+
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
20+
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
2021
}
2122

2223
$input = new ArgvInput();
23-
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
24-
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
24+
$env = $input->getParameterOption(['--env', '-e'], null, true);
25+
26+
if ($env) {
27+
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
2528
}
2629

2730
if ($input->hasParameterOption('--no-debug', true)) {
28-
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
31+
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
2932
}
3033

31-
require dirname(__DIR__).'/config/bootstrap.php';
34+
require dirname(__DIR__) . '/config/bootstrap.php';
3235

3336
if ($_SERVER['APP_DEBUG']) {
3437
umask(0000);
@@ -38,6 +41,7 @@ if ($_SERVER['APP_DEBUG']) {
3841
}
3942
}
4043

41-
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
42-
$application = new Application($kernel);
43-
$application->run($input);
44+
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
45+
46+
/** @noinspection PhpUnhandledExceptionInspection */
47+
(new Application($kernel))->run($input);

0 commit comments

Comments
 (0)