Aller au contenu

Constant Casing (ARCH7006)

Ce contenu n’est pas encore disponible dans votre langue.

Key php.naming.constant-screaming-snake · Severity info · Category naming

In PHP, class- and module-level constants should be written in UPPER_SNAKE_CASE. This convention visually separates constants from variables and clarifies intent.

<?php
class Config
{
const maxRetries = 3;
const default_timeout = 30;
}
<?php
class Config
{
const MAX_RETRIES = 3;
const DEFAULT_TIMEOUT = 30;
}

Rename constants to UPPER_SNAKE_CASE: all uppercase, words separated by underscores.