Skip to content
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

upgrade to PHP 8.3, remove sniff #578

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
version: "2"
checks:
argument-count:
enabled: true
enabled: false
complex-logic:
enabled: true
enabled: false
file-lines:
enabled: false
method-complexity:
enabled: true
enabled: false
method-count:
enabled: true
enabled: false
method-lines:
enabled: true
enabled: false
nested-control-flow:
enabled: true
return-statements:
enabled: true
enabled: false
similar-code:
enabled: false
identical-code:
Expand Down
75 changes: 13 additions & 62 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
validate:
name: "Validate Project"

uses: "mimmi20/ci/.github/workflows/validate.yml@8.1"
uses: "mimmi20/ci/.github/workflows/validate.yml@8.3"
with:
extensions: "ctype, curl, iconv, mbstring, ctype, dom, intl, simplexml, tokenizer, xml, xmlwriter, pdo"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -37,7 +37,7 @@

needs: "validate"

uses: "mimmi20/ci/.github/workflows/install.yml@8.1"
uses: "mimmi20/ci/.github/workflows/install.yml@8.3"
with:
extensions: "ctype, curl, iconv, mbstring, ctype, dom, intl, simplexml, tokenizer, xml, xmlwriter, pdo"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand Down Expand Up @@ -65,7 +65,7 @@

php-version:
# Should use the lowest supported version
- "8.1"
- "8.3"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -109,7 +109,7 @@

runs-on: "${{ matrix.operating-system }}"

timeout-minutes: 10
timeout-minutes: 30

continue-on-error: false

Expand All @@ -122,7 +122,7 @@

php-version:
# Should use the lowest supported version
- "8.1"
- "8.3"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -153,7 +153,12 @@
composer-options: "--optimize-autoloader --prefer-dist --prefer-stable -v"

- name: "Run squizlabs/php_codesniffer"
run: "vendor/bin/phpcs -wps --colors --standard=src/Mimmi20CodingStandard/ruleset.xml --extensions=php,stub -q --report=checkstyle src stubs .php-cs-fixer.php rector.php | cs2pr"
id: "phpcs"
run: "vendor/bin/phpcs -wps --colors --standard=src/Mimmi20CodingStandard/ruleset.xml --extensions=php --report-full --report-performance --report-checkstyle=./phpcs-report.xml -v src .php-cs-fixer.php rector.php"

- name: "Show PHPCS results in PR"
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: "cs2pr ./phpcs-report.xml"

static-code-analysis:
name: "Static Code Analysis with PHPStan"
Expand All @@ -175,7 +180,7 @@

php-version:
# Should use the lowest supported version
- "8.1"
- "8.3"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -203,64 +208,11 @@
uses: "ramsey/composer-install@3.0.0"
with:
dependency-versions: "lowest"
composer-options: "${{ inputs.composer-options }}"

Check failure on line 211 in .github/workflows/continuous-integration.yml

View workflow job for this annotation

GitHub Actions / actionlint

property "composer-options" is not defined in object type {}

- name: "Run phpstan/phpstan"
run: "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=768M --no-progress"

phpmd:
name: "Check Rules with PHPMD"

needs: "install"

runs-on: "${{ matrix.operating-system }}"

timeout-minutes: 10

continue-on-error: false

strategy:
fail-fast: false

matrix:
operating-system:
- "ubuntu-24.04"

php-version:
# Should use the lowest supported version
- "8.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
lfs: false
persist-credentials: false

- name: "Install PHP"
uses: "shivammathur/setup-php@2.31.1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "json, opcache"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
coverage: "none"
tools: "composer:v2, phpmd"
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
phpts: "nts"

- name: "Update dependencies with composer"
uses: "ramsey/composer-install@3.0.0"
with:
dependency-versions: "lowest"
composer-options: "${{ inputs.composer-options }}"

- name: "Run phpmd/phpmd"
run: "phpmd src github phpmd.ruleset.xml"

rector:
name: "Checks with Rector"

Expand All @@ -281,7 +233,7 @@

php-version:
# Should use the lowest supported version
- "8.1"
- "8.3"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -309,7 +261,7 @@
uses: "ramsey/composer-install@3.0.0"
with:
dependency-versions: "lowest"
composer-options: "${{ inputs.composer-options }}"

Check failure on line 264 in .github/workflows/continuous-integration.yml

View workflow job for this annotation

GitHub Actions / actionlint

property "composer-options" is not defined in object type {}

- name: "Run checks with rector/rector"
run: "vendor/bin/rector process --ansi --dry-run"
Expand All @@ -331,7 +283,6 @@
- "php-cs-fixer"
- "phpcs"
- "static-code-analysis"
- "phpmd"
- "rector"

steps:
Expand Down
1 change: 0 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
->files()
->name('*.php')
->in(__DIR__ . '/src')
->in(__DIR__ . '/stubs')
->append([__DIR__ . '/rector.php'])
->append([__FILE__]);

Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
"source": "https://github.com/mimmi20/coding-standard"
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"friendsofphp/php-cs-fixer": "^3.65.0",
"sirbrillig/phpcs-variable-analysis": "^2.11.21",
"slevomat/coding-standard": "^8.15.0",
"squizlabs/php_codesniffer": "^3.11.1"
},
Expand All @@ -44,7 +43,7 @@
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"rector/rector": "^1.2.10",
"rector/type-perfect": "^1.0.0",
"symfony/process": "^6.4.15",
"symfony/process": "^7.2.0",
"symplify/phpstan-rules": "^13.0.1",
"tomasvotruba/cognitive-complexity": "^0.2.3",
"tomasvotruba/type-coverage": "^1.0.0",
Expand Down
4 changes: 4 additions & 0 deletions phpcs-report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="3.11.1">
</checkstyle>

36 changes: 0 additions & 36 deletions phpmd.ruleset.xml

This file was deleted.

3 changes: 1 addition & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
parameters:
level: max

phpVersion: 80100 # PHP 8.1
phpVersion: 80300 # PHP 8.3

parallel:
maximumNumberOfProcesses: 1
processTimeout: 200.0

paths:
- src
- stubs

bootstrapFiles:
- %currentWorkingDirectory%/vendor/autoload.php
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

$rectorConfig->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_83,
PHPUnitSetList::PHPUNIT_100,
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Mimmi20CodingStandard\Sniffs\Commenting;

use Override;
use PHP_CodeSniffer\Exceptions\RuntimeException;
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down Expand Up @@ -60,6 +61,7 @@ final class FunctionCommentThrowTagSniff implements Sniff
*
* @throws void
*/
#[Override]
public function register(): array
{
return [T_FUNCTION];
Expand All @@ -76,6 +78,7 @@ public function register(): array
*
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
*/
#[Override]
public function process(File $phpcsFile, $stackPtr): void
{
$tokens = $phpcsFile->getTokens();
Expand Down
9 changes: 0 additions & 9 deletions src/Mimmi20CodingStandard/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,13 +1117,4 @@

<!-- Force rules for function phpDoc -->
<rule ref="Mimmi20CodingStandard.Commenting.FunctionCommentThrowTag"/>

<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<properties>
<!-- checked by SlevomatCodingStandard.Functions.UnusedParameter -->
<property name="allowUnusedFunctionParameters" value="true"/>
<!-- checked by SlevomatCodingStandard.Variables.UnusedVariable -->
<property name="allowUnusedVariablesInFileScope" value="true"/>
</properties>
</rule>
</ruleset>
Loading
Loading