From 7947cfbee8eacfda4de686729d89ae0dc7b5134b Mon Sep 17 00:00:00 2001 From: Max Antipin Date: Sat, 13 Dec 2025 22:06:06 +0300 Subject: [PATCH 1/4] Config Lint job --- .github/workflows/ci.yml | 47 +++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85855e3..45247b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,34 +26,43 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} lint: + name: Lint runs-on: ubuntu-latest + env: + php_ver: '8.4' steps: + - uses: actions/checkout@v4 + - name: Validate composer.json and composer.lock + run: composer validate --strict + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.php_ver }} + #extensions: pdo_sqlite, sqlite3, mbstring + coverage: none + - name: Install dependencies + run: composer install --no-autoloader --no-progress && composer dump-autoload --classmap-authoritative --strict-psr --strict-ambiguous - name: Lint run: echo "lint" test: runs-on: ubuntu-latest - # strategy: - # matrix: - # php-versions: ['8.2', '8.3', '8.4', '8.5'] - # coverage: [false] - # exclude: - # - php-versions: '8.4' - # coverage: false - # include: - # - php-versions: '8.4' - # coverage: true + strategy: + matrix: + php-versions: ['8.2', '8.3', '8.4', '8.5'] + coverage: [false] + exclude: + - php-versions: '8.4' + coverage: false + include: + - php-versions: '8.4' + coverage: true - # name: PHP ${{ matrix.php-versions }} on ${{ runner.os }} ${{ matrix.coverage && ' with code coverage' || '' }}" + name: "PHP ${{ matrix.php-versions }} ${{ matrix.coverage && 'with code coverage' || '' }}" # continue-on-error: ${{ matrix.coverage == true }} steps: - # - uses: actions/checkout@v4 - - # - name: Validate composer.json and composer.lock - # run: composer validate --strict - # - name: Cache Composer packages # id: composer-cache # uses: actions/cache@v3 @@ -63,11 +72,5 @@ jobs: # restore-keys: | # ${{ runner.os }}-php- - # - name: Install dependencies - # run: composer install --prefer-dist --no-progress - - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" - # Docs: https://getcomposer.org/doc/articles/scripts.md - - name: Run test suite run: echo "composer run-script test" From d645174fdff4ce3833eb2ac13c9aee68a14771db Mon Sep 17 00:00:00 2001 From: Max Antipin Date: Sun, 14 Dec 2025 12:57:51 +0300 Subject: [PATCH 2/4] Run linters --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45247b1..7d35142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,8 +42,14 @@ jobs: coverage: none - name: Install dependencies run: composer install --no-autoloader --no-progress && composer dump-autoload --classmap-authoritative --strict-psr --strict-ambiguous - - name: Lint - run: echo "lint" + - name: Run phpcs + run: php ./vendor/bin/phpcs + - name: Run phpstan + run: php ./vendor/bin/phpstan analyze + - name: Run phpcs-check-feature-completeness + run: php ./vendor/bin/phpcs-check-feature-completeness + - name: Run export-ignore + run: php ./vendor/bin/export-ignore test: runs-on: ubuntu-latest From d2963247f9838f6d360c4e781602e7f0e318d745 Mon Sep 17 00:00:00 2001 From: Max Antipin Date: Sun, 14 Dec 2025 13:09:11 +0300 Subject: [PATCH 3/4] phpstan config: make var dir optional --- phpstan.neon.dist | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d62ebca..7eee67c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,11 +1,11 @@ -parameters: - phpVersion: 80200 - level: 9 - paths: - - AntipinCS - excludePaths: - - var - - vendor - bootstrapFiles: - - vendor/autoload.php +parameters: + phpVersion: 80200 + level: 9 + paths: + - AntipinCS + excludePaths: + - var (?) + - vendor + bootstrapFiles: + - vendor/autoload.php - vendor/squizlabs/php_codesniffer/src/Util/Tokens.php \ No newline at end of file From 84b5d27cb229851f0a810b78533f999df76b0b69 Mon Sep 17 00:00:00 2001 From: Max Antipin Date: Sun, 14 Dec 2025 13:14:51 +0300 Subject: [PATCH 4/4] Bugfix: remove interface implementation --- .../Sniffs/Functions/ParameterTypeDeclarationSniff.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/AntipinCS/Sniffs/Functions/ParameterTypeDeclarationSniff.php b/AntipinCS/Sniffs/Functions/ParameterTypeDeclarationSniff.php index 1b9454e..9ca9be8 100644 --- a/AntipinCS/Sniffs/Functions/ParameterTypeDeclarationSniff.php +++ b/AntipinCS/Sniffs/Functions/ParameterTypeDeclarationSniff.php @@ -15,15 +15,11 @@ use PHP_CodeSniffer\Util\Tokens; use RuntimeException; -class ParameterTypeDeclarationSniff implements Sniff, \JsonSerializable +class ParameterTypeDeclarationSniff implements Sniff { private const RX_FQCN = '/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*(\\\\[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)+$/'; - public function jsonSerialize(): array - { - return []; - } /** * A list of functions and methods to ignore. *