Make the quality gates pass again - #669
Merged
Merged
Conversation
The configuration imported SetList::PHPUNIT and SetList::STRICT, two sets that no longer exist, so ECS aborted before analysing anything. Both are dropped: the three fixers STRICT used to bring (DeclareStrictTypes, StrictComparison, StrictParam) are already registered explicitly, and ECS now considers the PHPUnit set unsafe to run outside of Rector. The configuration also registered OrderedImportsFixer without any configuration, which silently discarded the "class, function, const" order that the CLEAN_CODE set had already set. That is the order the code base actually follows, so ECS reported a diff on 160 untouched files. It is now configured explicitly. The remaining drift is fixed: single line comment spacing, stray trailing commas in the #[AsCommand] attributes and the closing parenthesis of the multiline ones. Two byte flips in Chacha20Poly1305KeyEncryptionTest are rewritten with substr_replace(). The fixer turned "$tag[0] = $tag[0] ^ ..." into "$tag[0] ^= ...", which PHP rejects on a string offset with "Cannot use assign-op operators with string offsets". The flipped byte is unchanged.
The ergebnis rule set is removed from the configuration, as asked. It was producing 777 of the baseline entries, so the code base never followed it. The phpstan-beberlei-assert extension goes with it: beberlei/assert is not used anywhere in src/. The rest of the errors came from the type declarations that brick/math, Symfony and PHPStan itself have tightened since the baseline was written. They are fixed rather than baselined: - BigInteger, RSAKey, Math, AbstractECDH and KeyConverter now reject the empty string before handing it to BigInteger::fromBase(), which expects a non-empty-string. - Curve::generate(), JWKFactory::createOctKey() and RSACrypt keep their lengths positive, as random_bytes() and randomBits() now require. - "crit" and "key_ops" are checked to be lists of strings. Both are used with array_diff() and implode(), which a nested array would have broken. - KeyConverter requires the "key" entry it reads, and KeyConverter\RSAKey no longer indexes an array with the result of array_search(), which can be false. Two real defects surfaced on the way: - JsonConverter::decode() passed JSON_UNESCAPED_SLASHES and JSON_UNESCAPED_UNICODE to json_decode(). Both are encoding flags and were ignored. - JWEBuilder had a "?? null" on a property that is always set. The baseline is regenerated so that it describes what is left, without the entries that no longer match anything.
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Target branch: 4.2.x
Includes:
ECS and PHPStan had both drifted away from the tool versions in
ghcr.io/spomky-labs/phpqa. This makes the three gates green again on4.2.x.Easy Coding Standard
ECS did not run at all: the configuration imported
SetList::PHPUNITandSetList::STRICT, two sets that no longer exist, and aborted before analysing anything.STRICTused to bring (DeclareStrictTypes,StrictComparison,StrictParam) are already registered explicitly, and ECS now considers the PHPUnit set unsafe to run outside of Rector.OrderedImportsFixerwas registered without configuration, which silently discarded theclass, function, constorder thatCLEAN_CODEhad already set. That is the order the code base follows, so ECS reported a diff on 160 untouched files. It is now configured explicitly.#[AsCommand]attributes, and the closing parenthesis of the multiline ones.One fix had to be written by hand. On
Chacha20Poly1305KeyEncryptionTest, the fixer rewrotewhich PHP rejects with
Cannot use assign-op operators with string offsets. Both byte flips now go throughsubstr_replace(); the flipped byte is unchanged.PHPStan
The ergebnis rule set is removed from the configuration, as asked. It accounted for 777 of the baseline entries, so the code base never followed it.
phpstan-beberlei-assertgoes with it:beberlei/assertis not used anywhere insrc/.The rest came from type declarations tightened by brick/math, Symfony and PHPStan since the baseline was written. They are fixed rather than baselined:
BigInteger,RSAKey,Math,AbstractECDHandKeyConverterreject the empty string beforeBigInteger::fromBase(), which now expects anon-empty-string.Curve::generate(),JWKFactory::createOctKey()andRSACryptkeep their lengths positive, asrandom_bytes()andrandomBits()now require.critandkey_opsare checked to be lists of strings. Both are fed toarray_diff()andimplode(), which a nested array would have broken.KeyConverterrequires thekeyentry it reads, andKeyConverter\RSAKeyno longer indexes an array with the result ofarray_search(), which can befalse.Two real defects surfaced on the way:
JsonConverter::decode()passedJSON_UNESCAPED_SLASHESandJSON_UNESCAPED_UNICODEtojson_decode(). Both are encoding flags and were simply ignored.JWEBuilderhad a?? nullon a property that is always set.The baseline is regenerated so that it describes what is actually left, without the entries that no longer match anything.
Result
The 38 remaining failures are pre-existing, all in the bundle configuration tests, and untouched by this PR.
Note for reviewers: two caches survive a branch switch and will give you stale results.
var/cache/testholds the test kernel container, andtmp-phpqa/phpstanholds the PHPStan result cache. Clear both when comparing branches.