diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-09-16 09:32:05 +0200 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-09-16 09:32:05 +0200 |
commit | f9ce251db0643747727d454d56c5e8e1695a2c88 (patch) | |
tree | b3babe93d593ec6e575cda976ab216b9b9250391 /Model | |
parent | 603d5d719a763e070e85cb60cefd04274864de18 (diff) | |
download | Praspel-f9ce251db0643747727d454d56c5e8e1695a2c88.zip Praspel-f9ce251db0643747727d454d56c5e8e1695a2c88.tar.gz Praspel-f9ce251db0643747727d454d56c5e8e1695a2c88.tar.bz2 |
Fail early.
Diffstat (limited to 'Model')
-rw-r--r-- | Model/Variable.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Model/Variable.php b/Model/Variable.php index 866c867..0a78f03 100644 --- a/Model/Variable.php +++ b/Model/Variable.php @@ -157,18 +157,18 @@ class Variable */ public function __construct ( $name, $local, Clause $clause = null ) { - $this->_name = $name; - $this->_local = $local; - $this->_clause = $clause; - $this->_refDomains = &$this->_domains; - if( ('\old' === substr($name, 0, 4) || '\result' === $name) - && !($this->_clause instanceof Ensures)) + && !($clause instanceof Ensures)) throw new \Hoa\Praspel\Exception\Model( '\old(…) and \result are only allowed in @ensures, ' . 'given %s in @%s.', - 0, array($name, $this->getClause()->getName())); + 0, array($name, $clause->getName())); + + $this->_name = $name; + $this->_local = $local; + $this->_clause = $clause; + $this->_refDomains = &$this->_domains; return; } |