Skip to content

Conversation

@nielsdos
Copy link
Member

@nielsdos nielsdos commented Apr 6, 2025

No description provided.

@nielsdos nielsdos linked an issue Apr 6, 2025 that may be closed by this pull request
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

LGTM otherwise.

@nielsdos nielsdos marked this pull request as ready for review April 10, 2025 20:58
@nielsdos nielsdos requested a review from dstogov as a code owner April 10, 2025 20:58
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

This looks correct to me now. Thank you!

UPGRADING Outdated
RFC: https://wiki.php.net/rfc/marking_return_value_as_important
. Added asymmetric visibility support for static properties.
RFC: https://wiki.php.net/rfc/static-aviz
. It is now possible to use casts in constant expressions.
Copy link
Member

@iluuu1994 iluuu1994 Apr 10, 2025

Choose a reason for hiding this comment

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

Nit: "Added support for casts in constant expressions" for consistency?

case IS_OBJECT:
zend_cast_zval_to_object(result, &op1, IS_VAR);
break;
EMPTY_SWITCH_DEFAULT_CASE();
Copy link
Contributor

Choose a reason for hiding this comment

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

what about the new (void) cast?

Copy link
Member

Choose a reason for hiding this comment

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

Void casts are not allowed in expression context, only when their return value is not used. This never applies to constant expressions. This is also a different ast type (ZEND_AST_CAST_VOID), so it doesn't need to be handled here.

@nielsdos nielsdos merged commit 2f6c069 into php:master Apr 11, 2025
1 check passed
iluuu1994 added a commit to iluuu1994/php-src that referenced this pull request Apr 17, 2025
iluuu1994 added a commit to iluuu1994/php-src that referenced this pull request Apr 17, 2025
iluuu1994 added a commit to iluuu1994/php-src that referenced this pull request Apr 17, 2025
iluuu1994 added a commit that referenced this pull request Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow cast to be used in constant expressions

4 participants