mirror of
https://github.com/php/php-src.git
synced 2025-01-10 13:03:54 +08:00
2b3bebfa4c
Rather fix them for now by exempting function parameter defaults from *any* (non-ct) constant substitution (also from persistent constant substitution, which was already broken before)
31 lines
811 B
PHP
31 lines
811 B
PHP
--TEST--
|
|
ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() for namespace
|
|
--FILE--
|
|
<?php
|
|
|
|
namespace ReflectionTestNamespace {
|
|
CONST TEST_CONST_1 = "Test Const 1";
|
|
|
|
class TestClass {
|
|
const TEST_CONST_2 = "Test Const 2 in class";
|
|
}
|
|
}
|
|
|
|
namespace {
|
|
function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
|
|
echo $test;
|
|
}
|
|
$reflect = new ReflectionFunction('ReflectionParameterTest');
|
|
foreach($reflect->getParameters() as $param) {
|
|
if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
|
|
echo $param->getDefaultValueConstantName() . "\n";
|
|
}
|
|
}
|
|
echo "==DONE==";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
ReflectionTestNamespace\TestClass::TEST_CONST_2
|
|
ReflectionTestNamespace\CONST_TEST_1
|
|
==DONE==
|