Skip to content

Commit a04769f

Browse files
committed
Adapting missing constants analysis to new PHP 7 more strict rules
1 parent d669f3e commit a04769f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
],
2525
"require" : {
26-
"php" : ">=5.3.9",
26+
"php" : ">=5.4.6",
2727
"mouf/mouf-installer" : "~2.0.1",
2828
"mouf/mouf-validators-interface" : "~2.0",
2929
"container-interop/container-interop" : "~1.0",

src/Mouf/Reflection/MoufReflectionParameter.php

+3
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ public function toJson() {
207207
// In some cases, the call to getDefaultValue can log NOTICES
208208
// in particular if an undefined constant is used as default value.
209209
ob_start();
210+
if ($this->isDefaultValueConstant() && !defined($this->getDefaultValueConstantName())) {
211+
throw new \Exception('Constant "'.$this->getDefaultValueConstantName().'" does not exist.');
212+
}
210213
$result['default'] = $this->getDefaultValue();
211214
$possibleError = ob_get_clean();
212215
if ($possibleError) {

0 commit comments

Comments
 (0)