Skip to content

returntypewillchange.xml Add warning about future strict return type …#5608

Closed
mmalferov wants to merge 12 commits into
php:masterfrom
mmalferov:patch-4
Closed

returntypewillchange.xml Add warning about future strict return type …#5608
mmalferov wants to merge 12 commits into
php:masterfrom
mmalferov:patch-4

Conversation

@mmalferov

Copy link
Copy Markdown
Member

…enforcement

Should we not explicitly mention that internal methods will strictly enforce return types in future PHP versions?

Currently, the documentation might give developers a false sense of security, making it look like #[ReturnTypeWillChange] is a permanent fix. In reality, it only works during the tentative phase. Once PHP 9.0 drops, any remaining signature mismatches in child classes will cause a fatal error, as far as I understand

…enforcement

Should we not explicitly mention that internal methods will strictly enforce return types in future PHP versions?

Currently, the documentation might give developers a false sense of security, making it look like `#[ReturnTypeWillChange]` is a permanent fix. In reality, it only works during the tentative phase. Once PHP 9.0 drops, any remaining signature mismatches in child classes will cause a fatal error, as far as I understand
deprecation warnings during the tentative return type phase <emphasis>only</emphasis>.
Any remaining signatures mismatches will trigger an <constant>E_COMPILE_ERROR</constant> once internal methods
transition to standard strict return types. This breaking change is scheduled for PHP 9.0.0,
at which point a fatal error is raised and this attribute will no longer have any effect.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally avoid mentioning planned future release behaviour in the docs, since release plans can change and the information tends to become outdated quickly.

I think it would be enough to state it only suppresses deprecation notices during the tentative return type phase.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely agree that mentioning specific versions and error constants was overkill. I've removed them to keep the focus purely on the core behavior.

The term tentative return type was used in the warning without being defined anywhere else in the text, which could be confusing. So I briefly defined what the tentative phase actually means.

Thank you for the guidance! Ready for another look

@jordikroon jordikroon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we touch <para> it should become <simpara>. Could you do a rebase with master as well, so that checks will run correctly.

Comment thread language/predefined/attributes/returntypewillchange.xml Outdated
Comment thread language/predefined/attributes/returntypewillchange.xml Outdated
mmalferov and others added 6 commits June 14, 2026 14:32
Co-authored-by: Jordi Kroon <jordi@jordikroon.nl>
Co-authored-by: Jordi Kroon <jordi@jordikroon.nl>
…etqos_class (php#5609)

* Fix duplicate documentation for pcntl_getqos_class and pcntl_setqos_class

These functions were each documented in two files sharing the same xml:id.
The build normalizes _ to - in file-entity names, so the hyphen-named files
(php#5350) collided with the underscore-named ones (php#5506) and were silently
dropped. Merge both versions into the hyphen-named files and remove the
underscore-named ones.

* Address review: use exceptionname for Error and simpara for parameters

Mark the thrown Error with <exceptionname>, use <simpara> for the
qos_class description, and drop the <para> wrapper around its <variablelist>.
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.

3 participants