Skip to content

ci: green 4.9.x again with PHPStan 2.3.2 and Rector 2.7.0 - #230

Merged
Spomky merged 1 commit into
4.9.xfrom
fix/ci-green-4.9.x
Oct 31, 2026
Merged

Spomky merged 1 commit into
4.9.xfrom
fix/ci-green-4.9.x

Conversation

@Spomky

@Spomky Spomky commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

The open PRs (#227, #229) fail on 1️⃣ Static Analysis (PHPStan) and 3️⃣ Refactoring (Rector). They are not the cause: ghcr.io/spomky-labs/phpqa:8.4 now ships PHPStan 2.3.2 and Rector 2.7.0, and both flag code that is already on 4.9.x. The test jobs show as skipped on those PRs only because they depend on the static jobs.

PHPStan: src/Structure/VerifiableDataStructure/Rfc9162Sha256.php:131

Strict comparison using === between 0 and 1 will always evaluate to false.

PHPStan does not see the $i++ in the for initializer as changing $i across the outer foreach, so it reads $merges as always 0. The increment now sits after the inner loop. The merge count per leaf is the same, and the RFC 9162 fixtures (transparency-dev vectors) still pass.

Rector: 7 files

  • AssertTrueFalseToSpecificMethodRector: assertTrue(is_array(...)) / assertTrue(is_string(...)) become assertIsArray() / assertIsString() in six test files.
  • TernaryToNullsafeCoalesceRector in Ecdh::agree(): $wrap === null ? $layer->keyLength() : $wrap->keyLength() becomes $wrap?->keyLength() ?? $layer->keyLength(). KeyWrap::keyLength() returns int, so the two forms behave the same.

Verification

Run locally in ghcr.io/spomky-labs/phpqa:8.4 after composer update (highest, as in CI):

  • castor phpstan, castor rector, castor ecs, castor deptrac, castor lint: all exit 0
  • composer test: 3564 tests OK, 84 skipped (the known cose-wg divergences)

Once this is merged, #227 and #229 can be rebased onto 4.9.x.

Note: tests/PackagingTest.php on 4.8.x has the same assertTrue(is_array()) pattern, so Rector is probably red there too. Not changed here.

The phpqa:8.4 image now ships PHPStan 2.3.2 and Rector 2.7.0, which
fail on code already on 4.9.x:

- PHPStan does not see the `$i++` in the `for` initializer of
  Rfc9162Sha256::treeHash() as changing `$i` across the outer foreach,
  so it reads `$merges` as always 0 and flags `($merges & 1) === 1`.
  The increment now sits after the inner loop; the merge count is
  unchanged.
- Rector applies AssertTrueFalseToSpecificMethodRector
  (assertTrue(is_array()) -> assertIsArray()) in six test files and
  TernaryToNullsafeCoalesceRector in Ecdh::agree(); KeyWrap::keyLength()
  returns int, so `?->` + `??` is equivalent to the ternary.
@Spomky
Spomky merged commit 8af085b into 4.9.x Oct 31, 2026
18 checks passed
@Spomky
Spomky deleted the fix/ci-green-4.9.x branch October 31, 2026 14:11
Spomky added a commit that referenced this pull request Nov 23, 2026
* test: assert the types of PackagingTest with assertIsArray and assertIsString

Rector 2.8.5, in the phpqa:8.4 image rebuilt on 2026-11-22, applies
AssertTrueFalseToSpecificMethodRector to tests/PackagingTest.php:
assertTrue(is_array()) becomes assertIsArray() and assertTrue(is_string())
becomes assertIsString(), so `castor rector` exits 2 on 4.8.x.

The change is the one 4.9.x made to the same file in 8af085b (#230),
byte for byte, so the merge-up into 4.9.x takes it without a conflict.
The assertions check the same thing.

Assisted-by: Claude Opus 5.5

* test: a data provider yields what the test method accepts

The mutation testing job has failed on every push to 4.8.x since
10 September, and the failure is not in src/: Infection runs the newest
PHPUnit of the phpqa image (13.3.1 then, 13.4.8 now), while the test
jobs run phpunit-11. PHPUnit 13 warns when a data set carries more
arguments than the test method takes: 6 tests, 49 warnings, in four
classes. The suite is configured with failOnWarning, so the initial run
Infection needs exits 1 and it stops with "Project tests must be in a
passing state before running Infection".

This is the change 4.9.x made in e984d6b (#236), restricted to the four
classes 4.8.x has: KeyRestrictionEnforcementTest, PrehashedEdDSATest,
OversizedRsaKeyTest and DeprecatedTagClassesTest. Each rich provider
stays the single source of truth; the methods that read only its first
values take a narrow provider derived from it. No test, no data set and
no assertion changes: 124 tests and 296 assertions in these classes
before and after under phpunit-11, and the same under PHPUnit 13.4.8,
where the warnings are gone.

Assisted-by: Claude Opus 5.5

* docs: align the support matrix with the one of the default branch

RELEASES.md on 4.8.x still listed 4.8.x as in development, 4.7.x as
supported and 4.6.x and 4.5.x as receiving security fixes, while the
matrix of the default branch, which SECURITY.md names as the single
source of truth, lists 4.9.x in development, 4.8.x supported and
nothing below 4.8.x (#238).

The table is now the one of 4.9.x, line for line, so both branches say
the same thing and the merge-up into 4.9.x takes it without a conflict.

Assisted-by: Claude Opus 5.5
@Spomky Spomky mentioned this pull request Nov 23, 2026
Spomky added a commit that referenced this pull request Nov 23, 2026
* test: assert the types of PackagingTest with assertIsArray and assertIsString

Rector 2.8.5, in the phpqa:8.4 image rebuilt on 2026-11-22, applies
AssertTrueFalseToSpecificMethodRector to tests/PackagingTest.php:
assertTrue(is_array()) becomes assertIsArray() and assertTrue(is_string())
becomes assertIsString(), so `castor rector` exits 2 on 4.8.x.

The change is the one 4.9.x made to the same file in 8af085b (#230),
byte for byte, so the merge-up into 4.9.x takes it without a conflict.
The assertions check the same thing.

Assisted-by: Claude Opus 5.5

* test: a data provider yields what the test method accepts

The mutation testing job has failed on every push to 4.8.x since
10 September, and the failure is not in src/: Infection runs the newest
PHPUnit of the phpqa image (13.3.1 then, 13.4.8 now), while the test
jobs run phpunit-11. PHPUnit 13 warns when a data set carries more
arguments than the test method takes: 6 tests, 49 warnings, in four
classes. The suite is configured with failOnWarning, so the initial run
Infection needs exits 1 and it stops with "Project tests must be in a
passing state before running Infection".

This is the change 4.9.x made in e984d6b (#236), restricted to the four
classes 4.8.x has: KeyRestrictionEnforcementTest, PrehashedEdDSATest,
OversizedRsaKeyTest and DeprecatedTagClassesTest. Each rich provider
stays the single source of truth; the methods that read only its first
values take a narrow provider derived from it. No test, no data set and
no assertion changes: 124 tests and 296 assertions in these classes
before and after under phpunit-11, and the same under PHPUnit 13.4.8,
where the warnings are gone.

Assisted-by: Claude Opus 5.5

* docs: align the support matrix with the one of the default branch

RELEASES.md on 4.8.x still listed 4.8.x as in development, 4.7.x as
supported and 4.6.x and 4.5.x as receiving security fixes, while the
matrix of the default branch, which SECURITY.md names as the single
source of truth, lists 4.9.x in development, 4.8.x supported and
nothing below 4.8.x (#238).

The table is now the one of 4.9.x, line for line, so both branches say
the same thing and the merge-up into 4.9.x takes it without a conflict.

Assisted-by: Claude Opus 5.5
@Spomky Spomky mentioned this pull request Nov 23, 2026
Spomky added a commit that referenced this pull request Nov 23, 2026
* ci: green 4.8.x again with today's phpqa images (#240)

* test: assert the types of PackagingTest with assertIsArray and assertIsString

Rector 2.8.5, in the phpqa:8.4 image rebuilt on 2026-11-22, applies
AssertTrueFalseToSpecificMethodRector to tests/PackagingTest.php:
assertTrue(is_array()) becomes assertIsArray() and assertTrue(is_string())
becomes assertIsString(), so `castor rector` exits 2 on 4.8.x.

The change is the one 4.9.x made to the same file in 8af085b (#230),
byte for byte, so the merge-up into 4.9.x takes it without a conflict.
The assertions check the same thing.

Assisted-by: Claude Opus 5.5

* test: a data provider yields what the test method accepts

The mutation testing job has failed on every push to 4.8.x since
10 September, and the failure is not in src/: Infection runs the newest
PHPUnit of the phpqa image (13.3.1 then, 13.4.8 now), while the test
jobs run phpunit-11. PHPUnit 13 warns when a data set carries more
arguments than the test method takes: 6 tests, 49 warnings, in four
classes. The suite is configured with failOnWarning, so the initial run
Infection needs exits 1 and it stops with "Project tests must be in a
passing state before running Infection".

This is the change 4.9.x made in e984d6b (#236), restricted to the four
classes 4.8.x has: KeyRestrictionEnforcementTest, PrehashedEdDSATest,
OversizedRsaKeyTest and DeprecatedTagClassesTest. Each rich provider
stays the single source of truth; the methods that read only its first
values take a narrow provider derived from it. No test, no data set and
no assertion changes: 124 tests and 296 assertions in these classes
before and after under phpunit-11, and the same under PHPUnit 13.4.8,
where the warnings are gone.

Assisted-by: Claude Opus 5.5

* docs: align the support matrix with the one of the default branch

RELEASES.md on 4.8.x still listed 4.8.x as in development, 4.7.x as
supported and 4.6.x and 4.5.x as receiving security fixes, while the
matrix of the default branch, which SECURITY.md names as the single
source of truth, lists 4.9.x in development, 4.8.x supported and
nothing below 4.8.x (#238).

The table is now the one of 4.9.x, line for line, so both branches say
the same thing and the merge-up into 4.9.x takes it without a conflict.

Assisted-by: Claude Opus 5.5

* ci: let the mutation run outlive Composer's process timeout (#242)

`castor infect` runs `composer exec -- infection`, and `composer exec`
kills its child process after `process-timeout`, 300 seconds by default.
The Mutation Testing job of 4.9.x died at exactly that limit (run
45197554242). The one of 4.8.x still finishes, but its Infection step
took 232 seconds on the last push (run 45226114186), so a few more tests
or a slower runner would kill it the same way.

`COMPOSER_PROCESS_TIMEOUT=0` lifts that ceiling, and the job now carries
`timeout-minutes: 45` so that a run which really is stuck cannot burn
the six hours GitHub grants by default.

The variable is set by the castor task rather than by the workflow,
because `phpqa()` dropped its environment on exactly the path the CI
takes: it passed it as `docker run -e` options, and it skips Docker
whenever it already runs inside a container. The helper now takes a
name => value map and applies it to both paths.

This is 095a7fe (#241) of 4.9.x, byte for byte, so the merge-up into
4.9.x takes it without a conflict.

Assisted-by: Claude Opus 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant