Skip to content

Commit

Permalink
Adapting missing constants analysis to new PHP 7 more strict rules
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Aug 3, 2018
1 parent d669f3e commit a04769f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
],
"require" : {
"php" : ">=5.3.9",
"php" : ">=5.4.6",
"mouf/mouf-installer" : "~2.0.1",
"mouf/mouf-validators-interface" : "~2.0",
"container-interop/container-interop" : "~1.0",
Expand Down
3 changes: 3 additions & 0 deletions src/Mouf/Reflection/MoufReflectionParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public function toJson() {
// In some cases, the call to getDefaultValue can log NOTICES
// in particular if an undefined constant is used as default value.
ob_start();
if ($this->isDefaultValueConstant() && !defined($this->getDefaultValueConstantName())) {
throw new \Exception('Constant "'.$this->getDefaultValueConstantName().'" does not exist.');
}
$result['default'] = $this->getDefaultValue();
$possibleError = ob_get_clean();
if ($possibleError) {
Expand Down

0 comments on commit a04769f

Please sign in to comment.