From 080f3335eea0bda012ce46dcfe979edcb18ed851 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Sat, 30 Mar 2024 17:36:24 +0100 Subject: [PATCH] Update dependency versions in composer.json (#52) * Update dependency versions in composer.json The versions of 'infection/infection', 'rector/rector', and 'phpunit/phpunit' have been updated. This is important to ensure that our project stays up-to-date with the latest improvements and security patches. * Update phpstan-baseline.neon with new error definitions The phpstan-baseline.neon file has been updated to ignore additional specific error types associated with handling null|int parameters in several methods. These changes help maintain the code checking process without raising false positives. * Create standalone mutation testing workflow Moved Mutation Testing from the 'integrate' workflow to a separate workflow file 'infection.yml'. This decision was made to ensure a better separation of concerns within our workflows and to improve efficiency by reducing the runtime of the 'integrate' workflow. --- .github/workflows/infection.yml | 34 ++++++++++++++++++++++ .github/workflows/integrate.yml | 28 ------------------ composer.json | 6 ++-- phpstan-baseline.neon | 50 +++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/infection.yml diff --git a/.github/workflows/infection.yml b/.github/workflows/infection.yml new file mode 100644 index 0000000..905b450 --- /dev/null +++ b/.github/workflows/infection.yml @@ -0,0 +1,34 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow + +name: "Integrate" + +on: + push: + branches: + - "*.x" + +jobs: + mutation_testing: + name: "5️⃣ Mutation Testing" + runs-on: "ubuntu-latest" + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.3" + extensions: "json, mbstring, openssl, sqlite3, curl, uuid" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Fetch Git base reference" + run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--optimize-autoloader" + + - name: "Execute Infection" + run: "make ci-mu" diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 1f10ac1..f2372b7 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -145,34 +145,6 @@ jobs: - name: "Check coding style" run: "make ci-cs" - mutation_testing: - name: "5️⃣ Mutation Testing" - needs: - - "byte_level" - - "syntax_errors" - runs-on: "ubuntu-latest" - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.3" - extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Fetch Git base reference" - run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "highest" - composer-options: "--optimize-autoloader" - - - name: "Execute Infection" - run: "make ci-mu" - rector_checkstyle: name: "6️⃣ Rector Checkstyle" needs: diff --git a/composer.json b/composer.json index 1f5f319..8621e67 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,7 @@ "ext-gmp": "*", "ext-openssl": "*", "ekino/phpstan-banned-code": "^1.0", - "infection/infection": "^0.27", + "infection/infection": "^0.28", "php-parallel-lint/php-parallel-lint": "^1.3", "phpstan/extension-installer": "^1.3", "phpstan/phpstan": "^1.8", @@ -65,13 +65,13 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.3", - "rector/rector": "^0.19", + "rector/rector": "^1.0", "roave/security-advisories": "dev-latest", "symfony/phpunit-bridge": "^6.4|^7.0", "symfony/string": "^6.4|^7.0", "symfony/var-dumper": "^6.4|^7.0", "symplify/easy-coding-standard": "^12.0", - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^10.1|^11.0" }, "suggest": { "ext-openssl": "For OpenSSL based cyphering", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2aed0f8..0d8111a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,20 @@ parameters: ignoreErrors: + - + message: "#^Only numeric types are allowed in \\+, int\\|null given on the left side\\.$#" + count: 1 + path: src/ASN1/Component/Length.php + + - + message: "#^Only numeric types are allowed in \\-, int\\|null given on the right side\\.$#" + count: 1 + path: src/ASN1/Component/Length.php + + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Component\\\\Length\\:\\:expectFromDER\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Component/Length.php + - message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\:\\:expectTagged\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\TaggedType but returns \\$this\\(SpomkyLabs\\\\Pki\\\\ASN1\\\\Element\\)\\.$#" count: 1 @@ -10,11 +25,41 @@ parameters: count: 1 path: src/ASN1/Type/Constructed/ConstructedString.php + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\ConstructedString\\:\\:decodeDefiniteLength\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/ConstructedString.php + + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\ConstructedString\\:\\:decodeIndefiniteLength\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/ConstructedString.php + + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Sequence\\:\\:decodeDefiniteLength\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/Sequence.php + + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Sequence\\:\\:decodeIndefiniteLength\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/Sequence.php + - message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Set\\:\\:decodeFromDER\\(\\) should return SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Set but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Feature\\\\ElementBase\\.$#" count: 1 path: src/ASN1/Type/Constructed/Set.php + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Set\\:\\:decodeDefiniteLength\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/Set.php + + - + message: "#^Parameter &\\$offset by\\-ref type of method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\Constructed\\\\Set\\:\\:decodeIndefiniteLength\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/ASN1/Type/Constructed/Set.php + - message: "#^Method SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\PrimitiveString\\:\\:decodeFromDER\\(\\) should return static\\(SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\PrimitiveString\\) but returns SpomkyLabs\\\\Pki\\\\ASN1\\\\Type\\\\PrimitiveString\\.$#" count: 1 @@ -40,6 +85,11 @@ parameters: count: 1 path: src/ASN1/Type/Structure.php + - + message: "#^Parameter \\#2 \\$offset of static method SpomkyLabs\\\\Pki\\\\ASN1\\\\Component\\\\Length\\:\\:expectFromDER\\(\\) expects int, int\\|null given\\.$#" + count: 2 + path: src/ASN1/Type/Structure.php + - message: "#^Parameter \\#2 \\$key_algo of method SpomkyLabs\\\\Pki\\\\CryptoBridge\\\\Crypto\\\\OpenSSLCrypto\\:\\:_checkSignatureAlgoAndKey\\(\\) expects SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\AlgorithmIdentifier, SpomkyLabs\\\\Pki\\\\CryptoTypes\\\\AlgorithmIdentifier\\\\Feature\\\\AlgorithmIdentifierType given\\.$#" count: 2