[Policy, no patch] Normalize on usage of is_callable() instead of function_exists()

Created on 18 December 2010, over 14 years ago
Updated 24 January 2023, over 2 years ago

Instead of using function_exists() to verify if a callback exists, Drupal could use is_callable(); this would allow to use object and class methods as callbacks.

I am setting the release to Drupal 8, as I think it's too late to make such changes in Drupal 7.

🌱 Plan
Status

Needs review

Version

10.1

Component
Base 

Last updated about 23 hours ago

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    I agree, this is a good thing to do. Can we use phpstan to only allow the is_callable function?

  • Status changed to RTBC 23 days ago
  • 🇳🇿New Zealand quietone

    There is agreement here on making this change. And, in fact, there have been several issues implementing the change.

    A policy decision should be accompanied with documentation. And there has been a suggestion to enforce this change. That implies this could be a coding standard. Although forbidding the use of a PHP function seems too string.

    I have created a separate issue for doing the actual conversion, 📌 Convert function_exists() to is_callable() Active . Anyone wanting to discuss making this a coding standard should open an issue in the Coding Standards project.

    With all that I think the work on this part is complete.

Production build 0.71.5 2024