mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
feat: add php rule pack
This commit is contained in:
parent
0326442969
commit
ed366bddbb
12 changed files with 290 additions and 12 deletions
35
rules/php/coding-style.md
Normal file
35
rules/php/coding-style.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
paths:
|
||||
- "**/*.php"
|
||||
- "**/composer.json"
|
||||
---
|
||||
# PHP Coding Style
|
||||
|
||||
> This file extends [common/coding-style.md](../common/coding-style.md) with PHP specific content.
|
||||
|
||||
## Standards
|
||||
|
||||
- Follow **PSR-12** formatting and naming conventions.
|
||||
- Prefer `declare(strict_types=1);` in application code.
|
||||
- Use scalar type hints, return types, and typed properties everywhere new code permits.
|
||||
|
||||
## Immutability
|
||||
|
||||
- Prefer immutable DTOs and value objects for data crossing service boundaries.
|
||||
- Use `readonly` properties or immutable constructors for request/response payloads where possible.
|
||||
- Keep arrays for simple maps; promote business-critical structures into explicit classes.
|
||||
|
||||
## Formatting
|
||||
|
||||
- Use **PHP-CS-Fixer** or **Laravel Pint** for formatting.
|
||||
- Use **PHPStan** or **Psalm** for static analysis.
|
||||
- Keep Composer scripts checked in so the same commands run locally and in CI.
|
||||
|
||||
## Error Handling
|
||||
|
||||
- Throw exceptions for exceptional states; avoid returning `false`/`null` as hidden error channels in new code.
|
||||
- Convert framework/request input into validated DTOs before it reaches domain logic.
|
||||
|
||||
## Reference
|
||||
|
||||
See skill: `backend-patterns` for broader service/repository layering guidance.
|
||||
Loading…
Add table
Add a link
Reference in a new issue