-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from Codeception/php-cs-fixer-per2
Php cs fixer per2
- Loading branch information
Showing
49 changed files
with
557 additions
and
527 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
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,71 @@ | ||
name: Automated release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
static_analysis: | ||
name: Static Analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup PHP with PECL extension | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.4' | ||
- uses: ramsey/composer-install@v3 | ||
- name: Initialize cache | ||
uses: actions/cache@v4 | ||
with: | ||
key: phpstan | ||
path: .phpstan-cache | ||
- name: Run PHPStan | ||
run: vendor/bin/phpstan | ||
- name: Run ECS | ||
run: php vendor/bin/ecs | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [8.3, 8.4] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: pdo, sqlite, imagick | ||
coverage: none | ||
- uses: ramsey/composer-install@v3 | ||
- name: Run test suite | ||
run: | | ||
php vendor/bin/codecept build | ||
php vendor/bin/codecept run | ||
release: | ||
name: Automated release | ||
needs: | ||
- static_analysis | ||
- tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- run: > | ||
npx | ||
-p "@semantic-release/commit-analyzer" | ||
-p "@semantic-release/release-notes-generator" | ||
-p conventional-changelog-conventionalcommits | ||
-p semantic-release | ||
-- semantic-release --dry-run | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
packages: write | ||
contents: write | ||
pull-requests: write |
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
tests/_support | ||
tests/_output | ||
tests/cases/yii2-app-advanced/_data/db.sqlite | ||
.php-cs-fixer.cache | ||
.ecs-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,10 @@ | ||
{ | ||
"branches": ["master"], | ||
"plugins": [ | ||
["@semantic-release/commit-analyzer", { | ||
"preset": "conventionalcommits", | ||
"presetConfig": {} | ||
}], | ||
"@semantic-release/github", | ||
"@semantic-release/release-notes-generator"] | ||
} |
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
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,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
// ecs.php | ||
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff; | ||
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; | ||
use PhpCsFixer\Fixer\ClassNotation\FinalInternalClassFixer; | ||
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer; | ||
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer; | ||
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer; | ||
use PhpCsFixer\Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer; | ||
use PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer; | ||
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer; | ||
use PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer; | ||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
use Symplify\EasyCodingStandard\ValueObject\Set\SetList; | ||
|
||
return static function (ECSConfig $ecsConfig): void { | ||
// Parallel | ||
$ecsConfig->parallel(); | ||
|
||
$ecsConfig->cacheDirectory('.ecs-cache'); | ||
// Paths | ||
$ecsConfig->paths([ | ||
__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php' | ||
]); | ||
|
||
// A. full sets | ||
$ecsConfig->sets([SetList::PSR_12, SetList::SPACES, SetList::STRICT, SetList::DOCBLOCK]); | ||
|
||
$ecsConfig->rule(NotOperatorWithSuccessorSpaceFixer::class); | ||
$ecsConfig->rule(ArraySyntaxFixer::class); | ||
$ecsConfig->ruleWithConfiguration(GeneralPhpdocAnnotationRemoveFixer::class, [ | ||
'annotations' => ['author', 'inheritdoc', 'package'] | ||
]); | ||
$ecsConfig->rule(NoBlankLinesAfterPhpdocFixer::class); | ||
$ecsConfig->ruleWithConfiguration(NoSuperfluousPhpdocTagsFixer::class, [ | ||
'allow_mixed' => true | ||
]); | ||
$ecsConfig->rule(NoEmptyPhpdocFixer::class); | ||
$ecsConfig->rule(NoUnusedImportsFixer::class); | ||
$ecsConfig->ruleWithConfiguration(FinalInternalClassFixer::class, [ | ||
'annotation_exclude' => ['@not-fix', '@internal'], | ||
'annotation_include' => [], | ||
'consider_absent_docblock_as_internal_class' => true | ||
]); | ||
$ecsConfig->ruleWithConfiguration(ForbiddenFunctionsSniff::class, [ | ||
'forbiddenFunctions' => [ | ||
'passthru' => null, | ||
'var_dump' => null, | ||
] | ||
]); | ||
$ecsConfig->rule(PhpdocIndentFixer::class); | ||
$ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer::class); | ||
|
||
$ecsConfig->skip([ | ||
ForbiddenFunctionsSniff::class => [ | ||
'tests/**', | ||
'console/**' | ||
] | ||
]); | ||
|
||
// $ecsConfig->skip([ | ||
// FinalClassFixer::class => [ | ||
// 'tests/**' | ||
// ] | ||
// ]); | ||
}; |
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
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
Oops, something went wrong.