Skip to content

Commit

Permalink
Merge pull request webmozarts#207 from Ayesh/php8
Browse files Browse the repository at this point in the history
PHP 8: `method_exists()` fixes and composer.json version constraint update
  • Loading branch information
BackEndTea authored Jul 5, 2020
2 parents 4e99d71 + 8d99260 commit 69d0ffb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 69d0ffb

Please sign in to comment.