Decisions about php

Architectural decision records tagged with php

9 decisions
  1. accepted
    Use PHPStan for PHP code static analysis at level 6

    Static analysis catches type errors, logic bugs, and unsafe code paths without running the application, improving code quality at low cost.

    php drupal ci
  2. accepted
    Break composer install if patches don't apply

    Allowing builds to succeed with failed patches can lead to malformed code or hidden errors.

    drupal composer php
  3. accepted
    Use local copies of patch files

    When using cweagans/composer-patches, it is important that patch sources are consistent and do not change between builds.

    drupal php composer
  4. accepted
    Store Composer Patches configuration in composer.json

    Validating a complete Composer configuration is important to ensuring build issues are caught early.

    drupal php composer
  5. accepted
    Configure Composer Patches to Use `-p2` as `patchLevel` for Drupal core

    Drupal's git repository has a different directory structure than projects built on Drupal. Default Composer Patches settings can cause Drupal patches to be silently misapplied.

    drupal php composer
  6. deprecated
    Composer patches configuration and best practices

    Default composer-patches settings can lead to misapplied patches or hidden errors. Using a consistent configuration across projects will reduce errors and save time.

    drupal php composer
  7. accepted
    Use PHPUnit for unit testing PHP code
    drupal php coding testing
  8. accepted
    Always use typehints in new PHP code

    Following stricter typing where available can significantly reduce bugs, and simplify maintainability. This has been proven by several studies across different disciplines.

    drupal php coding
  9. accepted
    Use strict types in PHP code

    PHP's type coercion can cause logical errors within a program. For example, when a float is cast to an int, the decimal portion is lost. We aim to reduce these errors in our code, but they can easily slip through manual code review. Following stricter typing where available can significantly reduce bugs, as shown by Python's urllib3 type hinting case study.

    php drupal

Search Decisions