# PHP

  • Use PHP-CS with @Symfony rules by default. It contains PSR-2 and PSR-12 conventions
  • Use Psalm (opens new window).
  • Use PHPMD.
  • Add declare(strict_types=1); to each php file.
  • Use PHPUnit as test framework.
  • Use swagger to generate API documentation.

# Naming

  • Boolean variables and methods
    • There is a convention to prefix boolean variables and function names with "is" or "has", i.e. isLoggedIn , hasAccess or things like that.
    • Sometimes you have to name the variable to make it grammarly correct. Wrong isResourcesLoaded, correct is isEachResourceLoaded.
    • Do not use negative affirmations, i.e. isNotLoggedIn.
Last Updated: 10/28/2021, 8:19:03 AM