diff --git a/src/MiniSpec/expector.php b/src/MiniSpec/expector.php index 19d7de0..6314216 100644 --- a/src/MiniSpec/expector.php +++ b/src/MiniSpec/expector.php @@ -21,9 +21,10 @@ public function __call($name, $arguments) // throw new Exception("No expectation named ".$name); // } - if( array_key_exists($name, $expectations) ) { - $expectations[$name]::matcher($this->subject, $arguments); - } else { + if( array_key_exists($name, $this->expectations) ) { + $matcher = new $this->expectations[$name]; + $matcher->matcher($this->subject, $arguments); + } else { throw new Exception("No expectation named ".$name); } }