Repository navigation
Skip parameters with unresolved, test-only or conflicting evidence; nullable entity setters - #58
Merged
Merged
Conversation
TomasVotruba
force-pushed
the
safer-call-site-types
branch
from
November 15, 2026 23:12
a35aa2d to
b443dba
Compare
…ullable entity setters Typing from literal call sites alone broke Mautic at runtime: variables passed null, the DI container and forms called methods argtyper never saw, and child classes overrode the newly typed methods. - an unresolved argument (a variable) blocks the parameter - calls on an unresolved receiver count by method name and must agree - a call on a child class counts for the parent method it inherits - call sites only in tests do not add a type - a default value of another type blocks the parameter - a wider @PARAM doc type, instanceof or === false in the body block it - trait methods count as ancestors, and methods a child class, anonymous class or implementation overrides are skipped - setters of Doctrine entities always get a nullable type
TomasVotruba
force-pushed
the
safer-call-site-types
branch
from
November 15, 2026 23:16
b443dba to
70a6157
Compare
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.
Running on Mautic 8.x added 862 types, and CI broke badly: 1050 PHPUnit errors and 318 PHPStan errors. Literal call sites alone are not enough evidence. Variables passed
null, the DI container and forms called methods argtyper never saw, and child classes overrode newly typed methods.Now a parameter stays untyped when:
$x->m(),parent::m()) passes another type - these are now recorded by method name onlytest/testsdirs) - e.g. a service constructor that tests feed'id', while the container passesnullint $code = '200'was a fatal error@paramdoc type is wider (bool|Exception,object)instanceofor=== falseMethods are skipped when:
ControllerTrait::view()broke 36 API controllersTwo more changes:
$this->m()where a parent declaresm) now counts for the parent methodset*) of Doctrine entities, found by#[ORM\Entity]or@ORM\Entity, always get a nullable type, since forms and hydrators may passnullOn Mautic 8.x this goes from 862 to 174 types. Every class loads, and PHPStan reports nothing but stale baseline entries.