Skip to content

#18 PHPStan level 10 - #134

Merged
njoubert-cleverage merged 1 commit into
mainfrom
18
Oct 9, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
18

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #18

PHPStan level 10 (was 8) on src and tests, as the other bridges (archive, cache, doctrine, flysystem, rest, soap). 68 errors fixed (28 at level 9), no baseline, no ignoreErrors.

Changes

Almost all errors were mixed values used without being typed. They are narrowed by PHPDoc (@var on an assignment) where the type is already guaranteed (bundle configuration, form options and data, OptionsResolver allowed types, Doctrine results, validated command inputs), without changing the runtime behaviour:

  • CleverAgeUiProcessExtension: array shape of the processed configuration.
  • Controllers (LaunchAction, LogRecordCrudController, ProcessDashboardController, ProcessExecuteController, UserCrudController), LaunchType, UserCreateCommand, HttpProcessExecuteValueResolver, CronProcessMessageHandler, ProcessExecutionRepository::getLastProcessExecution(), ProcessSchedule::getContext().
  • ProcessConfigurationsManager: element types of the OptionsResolver closures (statuses, recipients, ui.default.context). PHPStan ignores a PHPDoc @param placed on the statement, and PHP-CS-Fixer (phpdoc_to_comment) turns a @var that is not followed by an assignment into a plain comment: hence the typed intermediate variables.
  • ProcessExecutionManager::increment(): early return when there is no current execution (same behaviour as the former nullsafe call).
  • UserCrudController::generateToken(): the entity manager is fetched for User::class (the FQCN of this CRUD) instead of $adminContext?->getEntity()->getFqcn() (nullable).

Typing changes visible from outside (no BC break):

  • LogProcessFilter::new(): $label typed TranslatableInterface|string|false|null instead of mixed. It is passed to EasyAdmin FilterTrait::setLabel(), which already has this native type: any other value already failed.
  • LogRecord::$context documented as array<mixed> (was array<string, mixed>), the type of the Monolog context it is built from.
  • ProcessExecution::getReport(): conditional return type ($key is null ? array<string, mixed> : mixed).

Tests: array shapes on $form->getPhpValues(), on the DBAL results and on the processed configuration; no assertion changed.

CHANGELOG: #18 entry under "Latest".

Checks

  • PHPStan (level 10), PHP-CS-Fixer, Rector: OK.
  • PHPUnit: 338 tests OK. The 2 PHPUnit deprecations ("depends" execution order, deprecated XML schema of phpunit.xml.dist) already exist on main.

Out of scope (not fixed)

  • HTTP API: a JSON context that is valid but not an object or an array (e.g. "1") passes the Json constraint of HttpProcessExecution, then json_decode() returns a scalar and a TypeError gives a 500. The PHPDoc only documents the existing assumption; this could be a separate issue.

Requirements

  • Documentation updates
    • Reference: N/A
    • Changelog
  • Unit tests: N/A (quality only, the existing tests pass)

Breaking changes

None.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 5347330 into main Oct 9, 2026
24 checks passed
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.

Improve phpstan quality level

1 participant