Skip to content

Commit

Permalink
Add phpcsfixer, add to shelf
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMendolia committed Sep 1, 2023
1 parent f53e988 commit 178ad17
Show file tree
Hide file tree
Showing 40 changed files with 919 additions and 505 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/symfony.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ jobs:
run: |
mkdir -p data
touch data/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
- name: Execute tests
env:
DATABASE_URL: sqlite:///%kernel.project_dir%/data/database.sqlite
run: vendor/bin/phpunit
- name: Execute PHPSTAN
env:
DATABASE_URL: sqlite:///%kernel.project_dir%/data/database.sqlite
run: composer test-phpstan
run: composer test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ docker-compose.override.yml
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
31 changes: 31 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @see https://cs.symfony.com/doc/rules/index.html
*/
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;

$config = new PhpCsFixer\Config('Biblioteca');
$config->setLineEnding(PHP_EOL);
$config->setFinder($finder);
$config->setRiskyAllowed(true);
$config->setRules([
'@Symfony' => true,
'increment_style' => false,
'logical_operators' => true,
'no_superfluous_phpdoc_tags' => false,
'phpdoc_align' => [
'align' => 'left',
],
'phpdoc_separation' => false,
'phpdoc_summary' => false,
'visibility_required' => [
'elements' => ['property', 'method', 'const'],
],
'yoda_style' => false,
]);

return $config;
26 changes: 21 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@
"test-phpstan": [
"Composer\\Config::disableProcessTimeout",
"env XDEBUG_MODE=off ./vendor/bin/phpstan analyse --memory-limit=-1"
],
"test-phpcs": [
"Composer\\Config::disableProcessTimeout",
"env XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix ./src --dry-run --verbose --config=.php-cs-fixer.dist.php"
],
"phpcs": [
"Composer\\Config::disableProcessTimeout",
"env XDEBUG_MODE=off ./vendor/bin/php-cs-fixer fix ./src -vv --verbose --config=.php-cs-fixer.dist.php"
],
"test-phpunit": [
"Composer\\Config::disableProcessTimeout",
"env XDEBUG_MODE=off ./vendor/bin/phpunit --colors=always"
],
"test": [
"composer test-phpcs && composer test-phpunit && composer test-phpstan"
]
},
"conflict": {
Expand All @@ -111,17 +126,18 @@
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.25",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-symfony": "^1.2",
"phpunit/phpunit": "^10.0",
"symfony/browser-kit": "^6.2",
"symfony/css-selector": "^6.2",
"symfony/debug-bundle": "^6.2",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^6.2",
"symfony/stopwatch": "^6.2",
"symfony/web-profiler-bundle": "^6.2",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-symfony": "^1.2"
"symfony/web-profiler-bundle": "^6.2"
}
}
Loading

0 comments on commit 178ad17

Please sign in to comment.