Skip to content

Improve PHPStan level from 8 to 10 #512

Backlog

Description

@njoubert-cleverage

Description

Follow-up of #143, closed once PHPStan level 8 was reached on dev-v6 (#253, v6.0: native nullable types that were never null narrowed).

Next step: improve the PHPStan level from 8 to 9, then 10, still without ignoreErrors nor @phpstan-ignore added.

Current state on dev-v6 (dc1c9f7): 520 errors at level 9, 629 at level 10 (510 in src/, 119 in tests/), mostly mixed values read from $options[...]. Main identifiers at level 10:

Identifier Errors
argument.type 315
offsetAccess.nonOffsetAccessible 87
cast.string 68
foreach.nonIterable 47
return.type 40
encapsedStringPart.nonString 23
offsetAccess.invalidOffset 18
binaryOp.invalid 11

The analysis made for #143 shows they can be fixed with PHPDoc (@var on the resolved options, typed array shapes) and local type narrowing, without changing native signatures: no breaking change is expected, so this does not require another major version. It needs level 8, so it targets a release after v6.0 (not 5.x).

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None expected (PHPDoc and local narrowing only, no native signature change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions