Laravel用のGitHub Actions
$ cd {my-project}
$ composer --dev require nunomaduro/larastan
$ composer --dev require friendsofphp/php-cs-fixer
$ touch phpstan.neon
Example phpstan.neon
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
# The level 9 is the highest level
level: 9
paths:
- app
- bootstrap
- database
- routes
- tests
excludePaths:
- database/factories/**.php
- routes/console.php
checkModelProperties: true
checkPhpDocMissingReturn: true
checkUnusedViews: true
$ ./vendor/bin/phpstan analyse --memory-limit=1G
$ touch .php-cs-fixer.dist.php
Example .php-cs-fixer.dist.php
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('somedir')
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder)
;
$ ./vendor/bin/php-cs-fixer fix --path-mode=intersection --config=.php-cs-fixer.dist.php --verbose --dry-run --allow-risky=yes ./