Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Zend/tests/ctor_promotion/ctor_promotion_callable_type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Type of promoted property may not be callable
<?php

class Test {
public function __construct(public callable $callable) {}
public function __construct(
public callable $callable
) {}
}

?>
--EXPECTF--
Fatal error: Property Test::$callable cannot have type callable in %s on line %d
Fatal error: Property Test::$callable cannot have type callable in %s on line 5
2 changes: 2 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7683,6 +7683,8 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
uint32_t property_flags = param_ast->attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_PPP_SET_MASK | ZEND_ACC_READONLY | ZEND_ACC_FINAL);
bool is_promoted = property_flags || hooks_ast;

CG(zend_lineno) = param_ast->lineno;

znode var_node, default_node;
uint8_t opcode;
zend_op *opline;
Expand Down