Skip to content

Commit 1232436

Browse files
committed
Add test to make sure internal param default eval doesn't error
1 parent 8ba6a83 commit 1232436

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Check that all internal parameter defaults evaluate without error
3+
--FILE--
4+
<?php
5+
6+
function checkDefaults(ReflectionFunctionAbstract $rf) {
7+
foreach ($rf->getParameters() as $param) {
8+
if ($param->isDefaultValueAvailable()) {
9+
try {
10+
$param->getDefaultValue();
11+
} catch (Error $e) {
12+
echo "{$rf->getName()}: {$e->getMessage()}\n";
13+
}
14+
}
15+
}
16+
}
17+
18+
foreach (get_defined_functions()["internal"] as $func) {
19+
$rf = new ReflectionFunction($func);
20+
checkDefaults($rf);
21+
}
22+
23+
foreach (get_declared_classes() as $class) {
24+
$rc = new ReflectionClass($class);
25+
foreach ($rc->getMethods() as $method) {
26+
checkDefaults($method);
27+
}
28+
}
29+
30+
?>
31+
===DONE===
32+
--EXPECT--
33+
===DONE===

0 commit comments

Comments
 (0)