Skip to content

Update screens for output that changed with PHP itself - #5720

Open
KentarouTakeda wants to merge 6 commits into
php:masterfrom
KentarouTakeda:fix-screen-behaviour-changes
Open

Update screens for output that changed with PHP itself#5720
KentarouTakeda wants to merge 6 commits into
php:masterfrom
KentarouTakeda:fix-screen-behaviour-changes

Conversation

@KentarouTakeda

Copy link
Copy Markdown
Contributor

Follow-up to #5718, from the same audit: the examples where PHP's own behaviour moved and the <screen> was never updated. One commit per kind of change.

  • +/- vs . precedence (8.0), constants left of instanceof (7.3)
  • reading a missing array key is a warning (8.0); the BackedEnum::from() ValueError no longer quotes the enum name (8.2)
  • internal functions declare return types (8.0)
  • anonymous class naming (8.0), var_export() leading backslash (8.2)
  • mb_detect_encoding() non-strict detection (8.3)
  • ReflectionClass::__toString() regenerated rather than attributed to one change; the Exception dump has drifted across several releases

Where a corrected screen would leave the page contradicting itself, the prose or comment moves with it: the foreach "notice" sentence, two comments in the precedence example, the mb_detect_encoding() comment, and the anonymous class note. The two reflection examples needed replacing outright — they used array_merge() to show that internals report no return type, which it now does, so a method with a tentative return type takes its place.

Pages to check with Run code

Press Run code and the output that appears is what this PR puts in the <screen>. The static one still on these pages is the "before" side of the diff, until the manual is rebuilt.

Since PHP 8.0 "+" and "-" bind tighter than ".", so the concatenation
example no longer prints -1. Its comments were written for the old
grouping and stayed behind; the example below it, kept non-interactive,
carries that history.

Since PHP 7.3 a constant is allowed on the left of instanceof and
evaluates to false instead of raising a fatal error; the prose above
that example already says so.
Reading a missing array key is a warning rather than a notice since PHP
8.0, so the sentence introducing that example moves with the screen.
Since PHP 8.2 the ValueError from BackedEnum::from() no longer quotes
the enum name.
Both pages used array_merge() to show that reflection reports no return
type for internal functions. Since PHP 8.0 it does report one, so the
examples demonstrated nothing and the paragraph warning about built-ins
was no longer true.

A method with a tentative return type is the case that still reports
none, so the examples use one and point at the accessors that return it.
The dump of Exception has drifted across several releases rather than
one: property types and defaults are printed differently, tentative
return types appeared, and the method count was stale. Regenerated from
PHP 8.5 instead of reconstructed.
Since PHP 8.0 an anonymous class is named after the class it extends.
The note further down that page still showed the PHP 7 form, captured on
3v4l.org rather than from the example; the NUL byte the name contains is
invisible in a screen, so the note now says so.

Since PHP 8.2 var_export() writes class names fully qualified, with a
leading backslash.
Non-strict detection follows the documented rule since PHP 8.3, so this
string now yields ASCII rather than UTF-8. The comment goes with it: it
named UTF-8 as the closer match, and the two candidates are in fact
equally distant here, so it should not name a winner at all.
@KentarouTakeda
KentarouTakeda force-pushed the fix-screen-behaviour-changes branch from 086ead5 to c043d6b Compare July 28, 2026 12:49
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.

1 participant