Skip to content

repo-template/laravelci-lint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravelci-lint

Laravel用のGitHub Actions

After Laravel new {my-project}

$ cd {my-project}
$ composer --dev require nunomaduro/larastan
$ composer --dev require friendsofphp/php-cs-fixer

[larastan] Create {my-project}/phpstan.neon

$ touch phpstan.neon

larastan rules

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

Run phpstan

$ ./vendor/bin/phpstan analyse --memory-limit=1G

[php-cs-fixer] Create {my-project}/.php-cs-fixer.dist.php

$ touch .php-cs-fixer.dist.php

php-cs-fixer rules

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)
;

Run phpcs-fixer

$ ./vendor/bin/php-cs-fixer fix --path-mode=intersection --config=.php-cs-fixer.dist.php --verbose --dry-run --allow-risky=yes ./

About

Laravel用のGitHub Actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages