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

🩹 avoid passing second parameter to class_exists #201

Merged
merged 1 commit into from
Mar 2, 2022
Merged

🩹 avoid passing second parameter to class_exists #201

merged 1 commit into from
Mar 2, 2022

Conversation

mikeyzm
Copy link
Contributor

@mikeyzm mikeyzm commented Mar 2, 2022

50d7a3f added provider class existence check, that would pass the key of app.providers as the second parameter to class_exists. 0 is a falsy value so class_exists does not check if the first provider class is autoloaded.

This PR uses closure instead of callable to avoid passing the second parameter to class_exists.

@QWp6t
Copy link
Member

QWp6t commented Mar 2, 2022

Do you want to also add a closure to ConfigCacheCommand?

@mikeyzm
Copy link
Contributor Author

mikeyzm commented Mar 2, 2022

No. array_filter passes value as the only argument to callback by default.

Collection::filter calls array_filter with the option ARRAY_FILTER_USE_BOTH which passes both value and key.

@QWp6t
Copy link
Member

QWp6t commented Mar 2, 2022

Oh yeah, of course. Good catch.

@QWp6t QWp6t changed the title Use closure to avoid passing the second parameter to class_exists 🩹 avoid passing second parameter to class_exists Mar 2, 2022
@QWp6t QWp6t merged commit e7d5f45 into roots:main Mar 2, 2022
@mikeyzm mikeyzm deleted the mikeyzm-patch-1 branch March 31, 2022 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants