-
Notifications
You must be signed in to change notification settings - Fork 40
Php cs fixer per2 #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Php cs fixer per2 #123
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e6fbf6f
chore(cs): use php-cs-fixer with PER2.0 standard
SamMousa 08c67d5
chore: update gitignore
SamMousa ceb78d2
chore: apply cs to tests
SamMousa ac7d74a
chore: use easy-coding-standard
SamMousa b89b65a
chore(ci): add ecs to ci
SamMousa bf3c801
chore(sa): update stub file
SamMousa 3bba227
fix: remove localeurls dependency and test case
SamMousa cd43a4e
chore(sa): update baseline
SamMousa 9afc444
chore(ci): add config for automated releases
SamMousa e763dee
fix: remove unused dep
SamMousa 6837963
chore: update code samples to use modern syntax
SamMousa 8366c51
chore(cs): use stricter rule set
SamMousa 97610ed
fix(cs): indent in phpdoc
SamMousa 0d98125
fix(cs): add rules for docblocks
SamMousa 785dea7
chore(cs): fix static analysis by improving stub
SamMousa 117117e
fix(sa): use Assert::fail so that phpstan understand code doesn't con…
SamMousa e045ef5
fix(ci): github token name
SamMousa d8111f0
fix(ci): use dry run for automated release
SamMousa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.