Skip to content

Add information about type declarations to Class Constants #4545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025

Conversation

beryllium
Copy link
Contributor

PHP 8.3 introduced types to class constants, but the documentation doesn't seem to mention this yet. This PR updates the doc to mention it & provide an example.

@tiffany-taylor
Copy link
Member

Aside from needing to fix the closing </screen> tag, LGTM.

@tiffany-taylor
Copy link
Member

Sigh. I've pulled these changes locally and verified that they validate and build correctly. The error in GitHub actions is unrelated. I need to check whether I need to try to rerun GitHub actions at a later time, or if building locally is sufficient.

@@ -28,6 +28,12 @@
Note that class constants are allocated once per class, and not for each
class instance.
</para>
<para>
As of PHP 8.3.0, class constants can have a scalar type such as <literal>bool</literal>,
<literal>int</literal>, <literal>float</literal>, <literal>string</literal>, or even
Copy link
Member

Choose a reason for hiding this comment

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

Nit: "or even" -> "and"
"and" is more muted in feeling, but I don't consider it an important enough change to block on.

@tiffany-taylor tiffany-taylor merged commit 922b4b5 into php:master Apr 16, 2025
2 of 4 checks passed
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.

2 participants