diff --git a/composer.json b/composer.json index bb478f57..2e609b63 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "require-dev": { diff --git a/src/Assert.php b/src/Assert.php index dd1ffe6e..b28e1784 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1620,7 +1620,7 @@ public static function propertyNotExists($classOrObject, $property, $message = ' */ public static function methodExists($classOrObject, $method, $message = '') { - if (!\method_exists($classOrObject, $method)) { + if (!(\is_string($classOrObject) || \is_object($classOrObject)) || !\method_exists($classOrObject, $method)) { static::reportInvalidArgument(\sprintf( $message ?: 'Expected the method %s to exist.', static::valueToString($method) @@ -1640,7 +1640,7 @@ public static function methodExists($classOrObject, $method, $message = '') */ public static function methodNotExists($classOrObject, $method, $message = '') { - if (\method_exists($classOrObject, $method)) { + if ((\is_string($classOrObject) || \is_object($classOrObject)) && \method_exists($classOrObject, $method)) { static::reportInvalidArgument(\sprintf( $message ?: 'Expected the method %s to not exist.', static::valueToString($method)