php-conventions
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 likeif (! $someValue). Negation is fine when the value is genuinelybool(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;
More from cosmastech/skills
multi-model-code-review
>-
22multi-model-planning
>-
17laravel-conventions
Personal Laravel conventions enforced when creating, modifying, or planning code that will touch code utilizing the Laravel framework.
13planning-conventions
Personal conventions for planning software changes. Covers planning doc structure, failure scenario analysis, refactoring sequencing, observability planning, and multi-model review. Activate when planning features, writing design docs, or scoping technical work.
3