@@ 464-475 (lines=12) @@ | ||
461 | * |
|
462 | * @throws InvalidArgumentException |
|
463 | */ |
|
464 | public static function isAOf($value, $class, $message = '') |
|
465 | { |
|
466 | static::string($class, 'Expected class as a string. Got: %s'); |
|
467 | ||
468 | if (!\is_a($value, $class, \is_string($value))) { |
|
469 | static::reportInvalidArgument(sprintf( |
|
470 | $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s', |
|
471 | static::typeToString($value), |
|
472 | $class |
|
473 | )); |
|
474 | } |
|
475 | } |
|
476 | ||
477 | /** |
|
478 | * @psalm-pure |
|
@@ 490-501 (lines=12) @@ | ||
487 | * |
|
488 | * @throws InvalidArgumentException |
|
489 | */ |
|
490 | public static function isNotA($value, $class, $message = '') |
|
491 | { |
|
492 | static::string($class, 'Expected class as a string. Got: %s'); |
|
493 | ||
494 | if (\is_a($value, $class, \is_string($value))) { |
|
495 | static::reportInvalidArgument(sprintf( |
|
496 | $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s', |
|
497 | static::typeToString($value), |
|
498 | $class |
|
499 | )); |
|
500 | } |
|
501 | } |
|
502 | ||
503 | /** |
|
504 | * @psalm-pure |