Ir al contenido

File Name Matches Type (ARCH7005)

Esta página aún no está disponible en tu idioma.

Key php.naming.file-name-matches-type · Severity info · Category naming

PSR-4 autoloading requires the file name to match the single top-level type it declares. A mismatch both breaks loading and makes the file hard to locate.

invoice.php
<?php
class PaymentProcessor
{
public function charge(int $amount): bool
{
return true;
}
}
PaymentProcessor.php
<?php
class PaymentProcessor
{
public function charge(int $amount): bool
{
return true;
}
}

Rename the file to match the primary type it declares (PaymentProcessor.php).