Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForInvalidReferenceType PHP Method

createForInvalidReferenceType() public static method

public static createForInvalidReferenceType ( string $reference ) : InvalidArgumentException
$reference string
return InvalidArgumentException
    public static function createForInvalidReferenceType(string $reference) : \InvalidArgumentException
    {
        return new \InvalidArgumentException(sprintf('Expected reference to be either a string or a "%s" instance, got "%s" instead.', ValueInterface::class, $reference));
    }

Usage Example

 public function testTestCreateForInvalidReferenceType()
 {
     $exception = InvalidArgumentExceptionFactory::createForInvalidReferenceType('foo');
     $this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got "foo"' . ' instead.', $exception->getMessage());
     $this->assertEquals(0, $exception->getCode());
     $this->assertNull($exception->getPrevious());
 }
All Usage Examples Of Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForInvalidReferenceType