EFL
Development

Coding standards

Coding standards and static analysis rules used in the SDK.

PHP version and typing

  • The SDK targets PHP ^8.2.
  • All PHP files should start with:
    <?php
    declare(strict_types=1);
    
  • Use strict scalar and object types for parameters and return values wherever possible.

Style and formatting

  • Follow PSR-12 for formatting and naming.
  • Use the provided PHP-CS-Fixer configuration:
    composer cs-check
    composer cs-fix
    

Static analysis

  • The project is configured with PHPStan.
  • Run analysis with:
    composer phpstan
    
  • New code should not introduce additional PHPStan errors or reduce the analysis level.

Documentation

  • Public classes, interfaces and methods should be documented with PHPDoc when:
    • Types are complex or not obvious.
    • Behaviour or invariants are non-trivial.
    • There are important edge cases or domain constraints.
  • Comments should explain why the code is written in a particular way, not restate what it does.