Update ORMInvalidArgumentException.php
`@return self` trend break with `@return ORMInvalidArgumentException`
This commit is contained in:
parent
88e071d22d
commit
04e4940607
@ -187,6 +187,28 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
|
|||||||
return new self("Binding entities to query parameters only allowed for entities that have an identifier.");
|
return new self("Binding entities to query parameters only allowed for entities that have an identifier.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param object $relation
|
||||||
|
* @param string $fieldname
|
||||||
|
* @param mixed $value
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public static function invalidAssociation($relation, $fieldname, $value)
|
||||||
|
{
|
||||||
|
return new self(sprintf('Expected an Object for relation %s::%s got %s instead.', get_class($relation), $fieldname, gettype($value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $entry
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public static function invalidAssociation($entry)
|
||||||
|
{
|
||||||
|
$ex = new self(gettype($entry) . (is_scalar($entry) ? ' "'.$entry.'"': '') . ' is not an Object.');
|
||||||
|
$ex->value = $entry;
|
||||||
|
return $ex;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to show an object as string.
|
* Helper method to show an object as string.
|
||||||
*
|
*
|
||||||
@ -198,20 +220,4 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
|
|||||||
{
|
{
|
||||||
return method_exists($obj, '__toString') ? (string)$obj : get_class($obj).'@'.spl_object_hash($obj);
|
return method_exists($obj, '__toString') ? (string)$obj : get_class($obj).'@'.spl_object_hash($obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ORMInvalidArgumentException
|
|
||||||
*/
|
|
||||||
public static function invalidAssociation($relation, $fieldname, $value) {
|
|
||||||
return new self('Expected an Object for relation '.get_class($relation).'::'.$fieldname.' got '.gettype($value).' instead.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ORMInvalidArgumentException
|
|
||||||
*/
|
|
||||||
public static function invalidAssociation($entry) {
|
|
||||||
$ex = new self(gettype($entry) . ' is not an Object.');
|
|
||||||
$ex->value = $entry;
|
|
||||||
return $ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user