1.1 Variables:
$userName = 'John'; $totalAmount = 100;
1.2 Functions and Methods:
function calculateTotalAmount($prices) { // Logic here }
1.3 Classes:
class UserController { // Class definition }
1.4 Constants:
define('MAX_RETRY_ATTEMPTS', 5); const DEFAULT_TIMEOUT = 30;
1.5 Interfaces:
interface CacheInterface { public function get(string $key): int; public function set(string $key, string $value); }
1.6 Abstract classes
abstract class AbstractJob { abstract public function getName(): string; // Other logic here }
1.7 Namespaces:
namespace App\Controllers;
Link to PSR-12 article: https://www.php-fig.org/psr/psr-12/
Principles: