aboutsummaryrefslogtreecommitdiffstats
path: root/Model/Behavior.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-25 15:10:46 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-25 15:10:46 +0100
commit977d226b11831034b7ca948a654958d34a1c62e3 (patch)
tree3a257340f364af2a67998b9335acd111a1e50de5 /Model/Behavior.php
parentc265aef4342feac7d19bee79c8476bc04efc31e0 (diff)
downloadPraspel-977d226b11831034b7ca948a654958d34a1c62e3.zip
Praspel-977d226b11831034b7ca948a654958d34a1c62e3.tar.gz
Praspel-977d226b11831034b7ca948a654958d34a1c62e3.tar.bz2
A @default can be declared if…
… at least one @behavior exists.
Diffstat (limited to 'Model/Behavior.php')
-rw-r--r--Model/Behavior.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/Model/Behavior.php b/Model/Behavior.php
index 6c5ee46..8fa173d 100644
--- a/Model/Behavior.php
+++ b/Model/Behavior.php
@@ -217,6 +217,11 @@ class Behavior extends Clause {
'Cannot add the @default clause, since an @ensures ' .
'or a @throwable clause exists at the same level.', 4);
+ if(false === $this->clauseExists('behavior'))
+ throw new \Hoa\Praspel\Exception\Model(
+ 'Cannot add a @default clause if at least one ' .
+ '@behavior clause has not been declared.', 5);
+
$handle = new DefaultBehavior($this);
break;