Skip to content

Commit

Permalink
Add PHP CS Fixer.
Browse files Browse the repository at this point in the history
  • Loading branch information
JaxkDev committed Aug 17, 2023
1 parent 5b4f7e4 commit ff26176
Show file tree
Hide file tree
Showing 12 changed files with 2,303 additions and 96 deletions.
58 changes: 54 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ on:
- '**.php'
- '.github/workflows/*'
- 'test/github/*'
pull_request:

jobs:
get-php:
name: Download PHP
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Check for PHP cache
id: php-cache
uses: actions/cache@v3
Expand All @@ -28,10 +29,59 @@ jobs:
if: steps.php-cache.outputs.cache-hit != 'true'
run: ./test/github/get-php.sh

Analysis:
code-style:
name: Code Style Checks
needs: get-php
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Restore PHP cache
id: php-cache
uses: actions/cache@v3
with:
path: "./bin"
key: "php-cache-${{ hashFiles('./test/github/get-php.sh') }}"

- name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH

- name: Install Composer
run: curl -sS https://getcomposer.org/installer | php

- name: Restore Composer package cache
id: composer-cache-php-cs-fixer
uses: actions/cache@v3
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
./vendor
key: "composer-v3-cache-php-cs-fixer-${{ hashFiles('./tools/php-cs-fixer/composer.lock') }}"
restore-keys: |
composer-v3-cache-php-cs-fixer-
- name: Install Composer dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: php composer.phar install -d tools/php-cs-fixer --no-interaction

- name: Save Composer package cache
if: steps.composer-cache.outputs.cache-hit != 'true'
id: composer-cache-save
uses: actions/cache/save@v3
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
./vendor
key: "composer-v3-cache-php-cs-fixer-${{ hashFiles('./tools/php-cs-fixer/composer.lock') }}"

- name: Run PHP-CS-Fixer
run: ./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --ansi

analysis:
name: PHPStan
needs: get-php
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
/dist/
/.cache/
/code-coverage/
/tools/php-cs-fixer/vendor/

*.phar
*.txt
*.DS_STORE

TEST.php
PHPSTAN.php
tools/TEST.php
tools/PHPSTAN.php
phpstan.neon
phpunit.xml
.phpunit.result.cache
.php-cs-fixer.cache
88 changes: 44 additions & 44 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 27 additions & 27 deletions .idea/jsonSchemas.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ff26176

Please sign in to comment.