forked from doctrine/doctrine1
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add(qa) php-cs-fixer config and github action
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: "Code Linting" | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
php-cs-fixer: | ||
name: 'PHP-CS-Fixer' | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
tools: php-cs-fixer:3.45, cs2pr | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: '.php-cs-fixer.cache' | ||
key: ${{ github.repository }}-8.2-phpcsfixer-${{ github.ref_name }} | ||
restore-keys: | | ||
${{ github.repository }}-8.2-phpcsfixer-master | ||
${{ github.repository }}-8.2-phpcsfixer- | ||
- name: Run PHP-CS-Fixer | ||
# Using cs2pr settings, see: https://github.com/shivammathur/setup-php#tools-with-checkstyle-support | ||
run: 'php-cs-fixer fix --dry-run --format checkstyle | cs2pr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ tests/DoctrineTest/doctrine_tests/* | |
/tests/tmp | ||
/tests/foo.sq3 | ||
/vendor/ | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->ignoreVCSIgnored(true) | ||
->in(__DIR__.'/lib') | ||
->in(__DIR__.'/tests') | ||
->append(array(__FILE__)) | ||
// Exclude generated files (single files) | ||
->notPath('should-be-ignored.php') | ||
; | ||
|
||
$config = new PhpCsFixer\Config(); | ||
$config->setRules(array( | ||
'@PhpCsFixer' => true, | ||
'@Symfony' => true, | ||
'array_syntax' => array( | ||
'syntax' => 'long', | ||
), | ||
'method_argument_space' => array( | ||
'on_multiline' => 'ensure_fully_multiline', | ||
), | ||
'general_phpdoc_annotation_remove' => array( | ||
'annotations' => array('version', 'license', 'since'), | ||
), | ||
'phpdoc_no_package' => true, | ||
'phpdoc_separation' => array( | ||
'groups' => array( | ||
array( | ||
'author', | ||
), | ||
array( | ||
'deprecated', | ||
'see', | ||
), | ||
array( | ||
'param', | ||
'return', | ||
'throws', | ||
), | ||
), | ||
), | ||
)) | ||
->setCacheFile('.php-cs-fixer.cache') | ||
->setFinder($finder) | ||
; | ||
|
||
return $config; |