- $callable = function(\stdClass $foo) {};
- $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$foo" argument.');
+ $callable = function (\stdClass $foo) {};
+ if (method_exists($this, 'expectException')) {
+ $this->expectException(\RuntimeException::class);
+ $this->expectExceptionMessage('requires a value for the "$foo" argument.');
+ }
+ else {
+ $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$foo" argument.');
+ }