php-conventions

Installation
SKILL.md

PHP Conventions

These are non-negotiable personal conventions unless explicitly overridden by the user.

Language & Syntax

  • Strict types — Every PHP file must declare declare(strict_types=1); at the top. If it is an existing file, you do not need to add it, but mention it to the user.

  • Prefer explicit falsy checks — Use the narrowest comparison that matches the real condition, such as === null, === '', or === 0, instead of broad checks like if (! $someValue). Negation is fine when the value is genuinely bool (for example, if (! $isEnabled)). This avoids surprising type coercion and makes intent clearer to humans and tools.

  • Import function calls and constants — Always use function and constant imports rather than calling global functions inline:

    use function array_key_exists;
    use function sprintf;
    use function count;
    
    use const JSON_THROW_ON_ERROR;
    
Related skills
Installs
15
GitHub Stars
5
First Seen
Apr 4, 2026