-
-
Notifications
You must be signed in to change notification settings - Fork 213
Refactor: properly handle callable array even when options are missing #1371
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
base: develop
Are you sure you want to change the base?
Refactor: properly handle callable array even when options are missing #1371
Conversation
Improved handling for cases where `$callable` is an array but does not include the `$callable['options']` key. In such cases, the default options are preserved and no errors occur. Also streamlined the normalization logic by explicitly checking for valid entries (`!empty()`)
@matteotrubini can you add some test cases for this? |
Expanded MarkupManagerTest to cover registration and validation of Twig functions, including handling of options, default options, empty callables, and invalid callables.
@LukeTowers, once I get your green light, I’ll proceed with makeTwigFilters() as described in the first comment. |
@matteotrubini ideally the options logic that's present everywhere in Winter could be centralized to a helper as much as possible. Should be good to proceed with the makeTwigFilters |
ed98069
to
4f88f25
Compare
39e3d0c
to
21c9cbd
Compare
I have finished my review and the tests are green. I would squash the commits before marking the PR as ready - what do you think, @LukeTowers? |
Improved handling for cases where
$callable
is an array but does not include the$callable['options']
key. In such cases, the default options are preserved and no errors occur.Also streamlined the normalization logic by explicitly checking for valid entries (
!empty()
)makeTwigFilters()
function as well for consistency.Eventually, both implementations could be unified into a shared helper, as they follow the same logic.