Repository navigation
[v6] #143 - Narrow nullable native types, improve PHPStan level to 8 - #253
Merged
Merged
Conversation
This was referenced Oct 9, 2026
Closed
…stractConfigurableTask::getOptions() and ProcessState::getContextualizedOptions() return array, CsvResource::$lineNumber and ProcessHistory::$startDate are not nullable. Improve PHPStan level from 7 to 8 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
njoubert-cleverage
force-pushed
the
143-v6
branch
from
December 1, 2026 14:19
7cd9ac6 to
813587e
Compare
njoubert-cleverage
marked this pull request as ready for review
December 1, 2026 14:19
4 tasks
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.
Description
Refs #143. v6.0 breaking change, based on
dev-v6. It must be released together with cleverage/archive-process-bundle (see the linked PR below).Step 3 of #143: the remaining level 8 errors all come from native nullable types that are never
nullin practice. PHPStan keeps thenullof the native type even with a stricter PHPDoc, so the native types are narrowed:AbstractConfigurableTask::getOptions(): array(was?array): options are always resolved when read;ProcessState::getContextualizedOptions(): array(was?array): always computed when read (its@phpstan-ignore return.unusedTypeis removed);CsvResource::$lineNumberis anint(was?int, initialized to1);ProcessHistory::$startDateis a\DateTimeInterface(was nullable, set in the constructor).Two level 8 errors of code merged since the first version of this PR are fixed without behaviour change:
GenericTransformer::initialize()(array_keys($this->contextualOptions ?? []), as in the rest of the class) and anassert()inTransformerTaskTest.phpstan.neongoes from level 7 to level 8 (no new ignore). Levels 9 and 10 are out of scope of this PR.PHPStan (level 8), PHPUnit (also with coverage, no risky test), PHP-CS-Fixer and Rector pass.
Linked PR
UnzipTaskandZipTaskoverridegetOptions(): ?array, which is a fatal error with this PR. The corrective PR declares anarrayreturn type, compatible with both process-bundle v5 and v6: it must be released before process-bundle v6.0.Requirements
getOptions()overrides must return anarray)Breaking changes
AbstractConfigurableTask::getOptions()declaring a?arrayreturn type, or ofProcessState::getContextualizedOptions(), fail with a fatal error; they must declarearray.CsvResource::$lineNumberorProcessHistory::$startDatewith a nullable type fail with a fatal error.🤖 Generated with Claude Code