Problem/Motivation

When we did #3608929: Adopt php-cs-fixer ruleset, we skipped native_function_invocation to avoid breaking too much MR

We merged many big stuff since (#3548884: SourceValueItem field synchronized translations, #3588936: Drupal 12 compatibility and Symfony Constraint API,#3611167: Escape at render, not in sources (rely on Twig autoescape)..) and it is time to reconsider it.

There is at least 676 native function invocation, in 173 files, and add leading \ before function invocation is speeding up resolving: https://blog.devsense.com/2025/optimize-native-function-invocation/#opti...

For example, phpunits tests run between 2% and 4% faster after the change.

Proposed resolution

  1. Remove $rules['native_function_invocation'] = FALSE;
  2. Run php-cs-fixer
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Issue summary: View changes

pdureau’s picture

Assigned: pdureau » grimreaper
Status: Active » Needs review
pdureau’s picture

Doing the change, I have noticed php-cs-fixer was not playing nice with our last plugin annotation (in ComponentFormDisplay), so I converted it to attributes thanks to drupal-rector.

grimreaper’s picture

Assigned: grimreaper » pdureau
Status: Needs review » Needs work

Hi,

Sorry, with the latest big commits, the MR needs to be rebased.

pdureau’s picture

Assigned: pdureau » grimreaper
Status: Needs work » Needs review

Rebased.

pdureau’s picture

Assigned: grimreaper » pdureau
Status: Needs review » Needs work

i will check Florent feedback

pdureau’s picture

Assigned: pdureau » grimreaper
Status: Needs work » Needs review

Changes done.

  • grimreaper committed 608ac32d on 2.0.x authored by pdureau
    task: #3615274 Add native_function_invocation to php-cs-fixer
    
    By:...
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.