@@ 1238-1247 (lines=10) @@ | ||
1235 | * |
|
1236 | * @throws InvalidArgumentException |
|
1237 | */ |
|
1238 | public static function endsWith($value, $suffix, $message = '') |
|
1239 | { |
|
1240 | if ($suffix !== \substr($value, -\strlen($suffix))) { |
|
1241 | static::reportInvalidArgument(\sprintf( |
|
1242 | $message ?: 'Expected a value to end with %2$s. Got: %s', |
|
1243 | static::valueToString($value), |
|
1244 | static::valueToString($suffix) |
|
1245 | )); |
|
1246 | } |
|
1247 | } |
|
1248 | ||
1249 | /** |
|
1250 | * @psalm-pure |
|
@@ 1673-1682 (lines=10) @@ | ||
1670 | * |
|
1671 | * @throws InvalidArgumentException |
|
1672 | */ |
|
1673 | public static function implementsInterface($value, $interface, $message = '') |
|
1674 | { |
|
1675 | if (!\in_array($interface, \class_implements($value))) { |
|
1676 | static::reportInvalidArgument(\sprintf( |
|
1677 | $message ?: 'Expected an implementation of %2$s. Got: %s', |
|
1678 | static::valueToString($value), |
|
1679 | static::valueToString($interface) |
|
1680 | )); |
|
1681 | } |
|
1682 | } |
|
1683 | ||
1684 | /** |
|
1685 | * @psalm-pure |