alleyinteractive / alleyinteractive/alley-coding-standards

Add sniff for modern callback syntax

Offen
#77 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
7
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Description

Rather than specifying action and filter callbacks as string representations of function names, or arrays of callables in class methods (e.g., `[ $this, 'my_callback_function' ]`), we should prefer modern (PHP 8+) callback syntax, e.g., `$this->my_callback_function( ... )` or `my_callback_function( ... )`.

### Use Case

When writing modern PHP, we should use modern callback syntax, since static code analysis tools and IDEs are better able to tie the specified function to its definition.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by locating the sniff that checks action and filter callbacks, then find its related tests or test entry point. Review the current handling of string callbacks and callable arrays, and define coverage for PHP 8+ first-class callable syntax; done means the sniff reports the older forms while accepting the modern forms described in the issue.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.