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

Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure) #4377

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

fabpot
Copy link
Contributor

@fabpot fabpot commented Oct 4, 2024

Instead of restricting callable arguments only in sandbox mode, let's deprecate using functions/arrays as callables.

Copy link
Member

@stof stof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good:

  • Twig already uses a Closure when using an arrow function
  • If passing a callable coming from PHP code, using the first-class callable syntax is an easy way to get a Closure for any callable.

@fabpot fabpot merged commit 5a4e868 into twigphp:3.x Oct 4, 2024
48 of 49 checks passed
@fabpot fabpot deleted the arrow-restrictions branch October 4, 2024 18:52
fabpot added a commit that referenced this pull request Oct 4, 2024
… arguments accepting arrow functions (pass a Closure) (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)

Instead of restricting callable arguments only in sandbox mode, let's deprecate using functions/arrays as callables.

Commits
-------

5e94483 Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)
fabpot added a commit that referenced this pull request Oct 4, 2024
… arguments accepting arrow functions (pass a Closure) (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)

Instead of restricting callable arguments only in sandbox mode, let's deprecate using functions/arrays as callables.

Commits
-------

5e94483 Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants