@@ 453-462 (lines=10) @@ | ||
450 | * |
|
451 | * @throws InvalidArgumentException |
|
452 | */ |
|
453 | public static function isInstanceOf($value, $class, $message = '') |
|
454 | { |
|
455 | if (!($value instanceof $class)) { |
|
456 | static::reportInvalidArgument(\sprintf( |
|
457 | $message ?: 'Expected an instance of %2$s. Got: %s', |
|
458 | static::typeToString($value), |
|
459 | $class |
|
460 | )); |
|
461 | } |
|
462 | } |
|
463 | ||
464 | /** |
|
465 | * @psalm-pure |
|
@@ 476-485 (lines=10) @@ | ||
473 | * |
|
474 | * @throws InvalidArgumentException |
|
475 | */ |
|
476 | public static function notInstanceOf($value, $class, $message = '') |
|
477 | { |
|
478 | if ($value instanceof $class) { |
|
479 | static::reportInvalidArgument(\sprintf( |
|
480 | $message ?: 'Expected an instance other than %2$s. Got: %s', |
|
481 | static::typeToString($value), |
|
482 | $class |
|
483 | )); |
|
484 | } |
|
485 | } |
|
486 | ||
487 | /** |
|
488 | * @psalm-pure |