Skip to content

Commit

Permalink
Fix issues identified by Psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 25, 2020
1 parent 0314d1b commit fb668be
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Framework/MockObject/Rule/MethodName.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,20 @@ final class MethodName
private $constraint;

/**
* @param Constraint|string
* @param Constraint|string $constraint
*
* @throws Constraint
* @throws \PHPUnit\Framework\Exception
* @throws InvalidArgumentException
*/
public function __construct($constraint)
{
if (!$constraint instanceof Constraint) {
if (!\is_string($constraint)) {
throw InvalidArgumentException::create(1, 'string');
}

if (\is_string($constraint)) {
$constraint = new MethodNameConstraint($constraint);
}

if (!$constraint instanceof Constraint) {
throw InvalidArgumentException::create(1, 'PHPUnit\Framework\Constraint\Constraint object or string');
}

$this->constraint = $constraint;
}

Expand Down

0 comments on commit fb668be

Please sign in to comment.