Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 error: method_exists(): Argument #1 ($object_or_class) must be of type object|string, array given #23

Closed
tuner7777 opened this issue Dec 30, 2020 · 3 comments
Assignees
Labels

Comments

@tuner7777
Copy link

There is a type error when using the operator get for PHP8.

Problem:
src/hasDirect.php in method_exists at line 36

dash/src/hasDirect.php

Lines 27 to 37 in bd6ec10

function hasDirect($input, $key)
{
if (!is_string($key) && !is_numeric($key) && !is_null($key)) {
return false;
}
return is_array($input) && array_key_exists($key, $input)
|| is_object($input) && property_exists($input, $key)
|| $input instanceof \ArrayAccess && $input->offsetExists($key)
|| method_exists($input, $key);
}

@mpetrovich
Copy link
Owner

Thanks for reporting! Dash isn't currently tested against PHP 8, but I'll make sure it is and will fix errors like this one.

@mpetrovich mpetrovich added the bug label Jan 27, 2021
@mpetrovich mpetrovich self-assigned this Jan 27, 2021
@mpetrovich
Copy link
Owner

I don't have bandwidth to address this issue right now, but I welcome all PRs if anyone would like to contribute.

@mpetrovich
Copy link
Owner

Fixed in v4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants