63fc74a751
In repo mode this does the right thing and returns the right constant, but for non-repo it thinks it is an undefined non-namespace constant. I'll have to do something more hardcore if that starts to matter While I was in there, I made the correct name for `ReflectionParameter` that was added in 5.4 instead of the draft we copied.
29 linhas
592 B
PHP
29 linhas
592 B
PHP
<?php
|
|
|
|
namespace A {
|
|
const B = 'c';
|
|
class D {
|
|
public function e($f = PHP_VERSION, $g = B,
|
|
$h = array(PHP_VERSION), $i = array(B)) {
|
|
}
|
|
}
|
|
function j($k = PHP_VERSION, $l = B, $m = array(PHP_VERSION), $n = array(B)) {
|
|
}
|
|
}
|
|
|
|
namespace {
|
|
$tests = array(
|
|
new ReflectionMethod('A\D', 'e'),
|
|
new ReflectionFunction('A\j'),
|
|
);
|
|
foreach ($tests as $method) {
|
|
$params = $method->getParameters();
|
|
foreach ($params as $param) {
|
|
var_dump(
|
|
$param->getDefaultValue(),
|
|
$param->getDefaultValueConstantName()
|
|
);
|
|
}
|
|
}
|
|
}
|