reference appendices

Reserved Words

Reserved words have a special meaning to PHP and cannot always be used freely for classes, interfaces, traits, enums, functions, constants, or namespaces. Check the manual when naming code that must work across supported PHP versions.

Use This Reference When

  • A parser error appears after introducing a class or method name.
  • A library must support multiple PHP versions.
  • Generated code derives identifiers from external schemas.

Naming Check

PHP example
<?php

final class OrderReport
{
    public function matchStatus(string $status): bool
    {
        return $status === 'paid';
    }
}

echo (new OrderReport())->matchStatus('paid') ? "yes\n" : "no\n";

// Prints:
// yes

Method names have more flexibility than class names, but clarity matters more than exploiting every allowed edge case.

Practice

Check a Generated Identifier

Choose three identifiers from an API schema and check whether they can safely become PHP class names. Record any renaming rule.

Show solution

Compare proposed class names against the reserved-word manual page. Use a stable mapping rule such as appending Value or Type where a schema name conflicts.