diff --git a/.cursorrules b/.cursorrules index 6b0037a..852cc01 100644 --- a/.cursorrules +++ b/.cursorrules @@ -6,3 +6,8 @@ - add phpunit tests to all methods - add inline comments to all logic explaining the steps being taken - use readonly properties where appropriate +- use phpstan annotations to improve code quality +- use phpcs to enforce code style +- use phpcbf to fix code style issues +- apply all the rules defined in phpcs.xml +- use phpunit to test all methods diff --git a/.github/workflows/phpcbf.yml b/.github/workflows/phpcbf.yml new file mode 100644 index 0000000..1f9ba45 --- /dev/null +++ b/.github/workflows/phpcbf.yml @@ -0,0 +1,21 @@ +name: Automatically Run PHPCBF to fix code style issues +on: [push] +jobs: + phpcbf: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + - name: Run PHPCBF + run: ./vendor/bin/phpcbf --standard=psr12 ./bad.php + continue-on-error: true + #- name: Commit Changes + # uses: stefanzweifel/git-auto-commit-action@v4 \ No newline at end of file diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 0000000..7d840fb --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,16 @@ +name: PHPCS +on: [push] +jobs: + phpcs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + - name: Run PHPCS + run: ./vendor/bin/phpcs --standard=psr12 ./bad.php \ No newline at end of file diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..a67dc43 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,14 @@ +name: CI + +on: [push] + +jobs: + build-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: php-actions/composer@v6 # or alternative dependency management + - uses: php-actions/phpstan@v3 + with: + path: lib/ \ No newline at end of file diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..eb935f6 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,154 @@ + + + The coding standard for PHP_CodeSniffer itself, for more config -> for https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options. + + README.md + src + + + + + + + + error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + error + + + + + error + + + + + tests/bootstrap\.php + + + + + tests/Core/Tokenizer/StableCommentWhitespaceWinTest\.php + + +