Skip to content

[12.x] Prefer Symfony PHP polyfills over function_exists calls #56621

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

Merged
merged 2 commits into from
Aug 11, 2025

Conversation

jnoordsij
Copy link
Contributor

In various places of the codebase, function_exists calls are employed to allow usage of functions introduced in recent PHP versions without breaking backwards compatibility. This has two major downsides namely:

  • having more complicated code at current, as two implementations need to be maintained
  • these might be harder to spot and replace in the future, when a higher PHP version is enforced and thus these checks become obsolete.

Therefore this PR proposes to use the Symfony polyfills instead. This will ensure the functions are available on all supported PHP versions, thus retaining backwards compatibility, without requiring any code modifications. Moreover, given these are easily findable in the corresponding composer.json files, they can be easily removed in the future when the PHP version is raised, without further checking which functions correspond to which PHP version.

@taylorotwell taylorotwell merged commit b83089f into laravel:12.x Aug 11, 2025
60 checks passed
@jnoordsij jnoordsij deleted the prefer-polyfill branch August 11, 2025 14:49
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