Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
Use InvalidArgumentException, because it's better then RuntimeExpcetion
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Sep 16, 2015
1 parent 8114222 commit 553b094
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Visitor/Expression/AbstractExpressionCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

namespace PHPSA\Visitor\Expression;

use Doctrine\Instantiator\Exception\InvalidArgumentException;
use PHPSA\CompiledExpression;
use PHPSA\Context;
use PHPSA\Visitor\ExpressionCompilerInterface;
use RuntimeException;

abstract class AbstractExpressionCompiler implements ExpressionCompilerInterface
{
Expand All @@ -21,7 +21,7 @@ abstract class AbstractExpressionCompiler implements ExpressionCompilerInterface
protected function assertExpression($expression)
{
if (!$expression instanceof $this->name) {
throw new RuntimeException('Passed $expression must be instance of ' . $this->name);
throw new InvalidArgumentException('Passed $expression must be instance of ' . $this->name);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPSA/Expression/ExpressionCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testPassUnexpectedExpression()
$this->assertSame('PhpParser\Node\Expr\UnaryMinus', $expr->getName());

$this->setExpectedException(
'RuntimeException',
'InvalidArgumentException',
'Passed $expression must be instance of PhpParser\Node\Expr\UnaryMinus'
);
$expr->pass($this->newFakeScalarExpr(), $this->getContext());
Expand Down

0 comments on commit 553b094

Please sign in to comment.