Skip to content

Fix: nullsafe fetch on an unread non-null property receiver is typed nullable - #13946

Merged
alies-dev merged 7 commits into
vimeo:masterfrom
alies-dev:alies-dev/nullsafe-fetch-on-a-non-null-property-receiver-i
Nov 16, 2026
Merged

alies-dev merged 7 commits into
vimeo:masterfrom
alies-dev:alies-dev/nullsafe-fetch-on-a-non-null-property-receiver-i

Conversation

@alies-dev

@alies-dev alies-dev commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

A nullsafe fetch or call on a non-null property that was not read before is typed nullable, as if the receiver could be null.

Before

<?php
final class Item { public bool $flag = true; }
final class Holder { public function __construct(public Item $item) {} }

/** @var Holder $h */
$h = null;
$_r = $h->item?->flag; // bool|null

After

$_r = $h->item?->flag; // bool

Fixes #13936

@alies-dev alies-dev added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 16, 2026
@alies-dev alies-dev self-assigned this Nov 16, 2026
@alies-dev
alies-dev marked this pull request as ready for review November 16, 2026 15:51
@alies-dev alies-dev closed this Nov 16, 2026
@alies-dev alies-dev reopened this Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Performance: unchanged · Issues: unchanged

Project Memory (MB) Wall (s) Issues Weighted
✅ laravel 1 692 56.4 $\color{gray}{\textsf{-0.4\%}}$ 26 018 50 881
✅ symfony 3 611 247.8 $\color{gray}{\textsf{+2.3\%}}$ 50 739 99 242
✅ doctrine-orm 392 11.7 $\color{gray}{\textsf{-0.3\%}}$ 3 523 5 586
✅ psl 632 14.9 $\color{gray}{\textsf{+0.5\%}}$ 1 329 5 179
✅ phpunit 470 18.4 $\color{gray}{\textsf{+1.0\%}}$ 1 604 1 207
✅ php-parser 232 11.8 $\color{gray}{\textsf{-0.5\%}}$ 17 124 20 525
✅ tempest 889 31.4 $\color{gray}{\textsf{+0.6\%}}$ 4 936 9 288
✅ amphp-amp 61 1.3 $\color{gray}{\textsf{-0.8\%}}$ 29 49
✅ webmozarts-assert 283 3.0 577 2 720
✅ guzzle-promises 55 1.3 161 406
✅ monolog 153 3.6 $\color{gray}{\textsf{+2.6\%}}$ 902 2 181
✅ drupal 4 748 213.7 $\color{gray}{\textsf{-3.6\%}}$ 98 144 160 254
Total 13 217 615.1 $\color{gray}{\textsf{-0.4\%}}$ 205 086 357 518
How to read this table
  • Memory: Psalm's own peak figure, threads=1. More than +5 % fails, unless the PR changes composer.json.
  • Wall: base and head run on the same runner; ±10 % is noise. Above +20 % warns, never fails. re-run: a reversed second run was taken and the faster kept.
  • Issues: head count, then $\color{red}{\textsf{+added}}$ $\color{green}{\textsf{-removed}}$ against base.
  • Weighted: issues weighted by error level (levels 1–8 as is, always-errors 10, feature-specific and purity suggestions 0). The projects' own code is pinned and their dependencies resolve identically for base and head, so a change means Psalm reports more, fewer or differently serious issues. A rise is not necessarily a regression.
  • Total: sum over the projects compared on both sides. Thresholds apply per project, not to the total.
  • Colors: $\color{red}{\textsf{red}}$ past a fail or warn threshold (or more issues), $\color{green}{\textsf{green}}$ an improvement past noise (or fewer issues), $\color{gray}{\textsf{gray}}$ noise.
  • Performance: regressed if a head run crashed or timed out or a memory or wall delta is red, else improved if one is green, else unchanged. Its icon is the check result: ❌ fail · ⚠️ warn · ✅ pass; the icon next to each project is that project's result, 💥 = not comparable: base crashed or timed out (counts as ⚠️).
  • Issues (heading): the total weighted change, increased · decreased · unchanged, followed by the issues added and removed across the projects, e.g. increased (+175 −128). If the weighted total is zero but issues were added or removed (those weighted 0 changed, or changes offset), it reads changed (+175 −128, weighted unchanged). Informational, never fails the check.

head f364b67 · base e141f40 (merge-base) · workflow run

@alies-dev
alies-dev merged commit 8b0c123 into vimeo:master Nov 16, 2026
62 of 70 checks passed
@alies-dev
alies-dev deleted the alies-dev/nullsafe-fetch-on-a-non-null-property-receiver-i branch November 16, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nullsafe fetch on a non-null property receiver is typed nullable since 7.7.0

1 participant