Skip to content

Commit 7fa8cee

Browse files
Happy path at the bottom
1 parent 254926f commit 7fa8cee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Zend/zend_attributes.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ static zend_string *validate_nodiscard(
218218
{
219219
ZEND_ASSERT(CG(in_compilation));
220220
const zend_string *prop_info_name = CG(context).active_property_info_name;
221-
if (prop_info_name == NULL) {
222-
zend_op_array *op_array = CG(active_op_array);
223-
op_array->fn_flags |= ZEND_ACC_NODISCARD;
224-
return NULL;
221+
if (prop_info_name != NULL) {
222+
// Applied to a hook
223+
return ZSTR_INIT_LITERAL("#[\\NoDiscard] is not supported for property hooks", 0);
225224
}
226-
// Applied to a hook
227-
return ZSTR_INIT_LITERAL("#[\\NoDiscard] is not supported for property hooks", 0);
225+
zend_op_array *op_array = CG(active_op_array);
226+
op_array->fn_flags |= ZEND_ACC_NODISCARD;
227+
return NULL;
228228
}
229229

230230
ZEND_METHOD(NoDiscard, __construct)

0 commit comments

Comments
 (0)