Automattic / Automattic/VIP-Coding-Standards
Catch incorrect bloginfo() usage
- Lingua principale
- PHP
- Stelle
- 261
- Fork
- 44
- Merge medio
- 19m
- PR unite (30g)
- 1
Descrizione
## What problem would the enhancement address for VIP?
When using `bloginfo()`, the caller should not echo the output, as `bloginfo()` does this internally (see [here](https://developer.wordpress.org/reference/functions/bloginfo/#source)). Callers should simply call `bloginfo()` without any `echo`, but if the callers want to control when the output is echoed, they should use `get_bloginfo()` ([#](https://developer.wordpress.org/reference/functions/get_bloginfo/)). Our standards should catch these kinds of issues in code.
## Describe the solution you'd like
The usage of `echo bloginfo()` should be caught and advice given on using `get_bloginfo()` instead or to skip the echo.
## What code should be reported as a violation?
echo bloginfo( 'name' );
## What code should *not* be reported as a violation?
echo get_bloginfo( 'name' );
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Iniziare con le regole di PHP_CodeSniffer che analizzano l’uso delle funzioni, usando bloginfo() e get_bloginfo() come punti di ingresso. Verificare che echo bloginfo( 'name' ) venga segnalato con l’indicazione di omettere echo o usare get_bloginfo(), mentre echo get_bloginfo( 'name' ) non venga segnalato; eseguire i test delle regole pertinenti, se disponibili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100