Skip to content

v1.0.1

Latest

Choose a tag to compare

@cristoforocervino cristoforocervino released this 22 Nov 00:46

Added

PHPStan Extension

  • NEW: PHPStan static analysis extension to validate #[NullableEmbeddable] classes and prevent common runtime errors
  • The extension automatically validates three critical rules:
    1. Property Initialization: Flags properties with non-null default values outside the constructor (e.g., private bool $enabled = false;), which cause Doctrine hydration issues
    2. Nullable Columns: Ensures all #[Column] mappings are nullable (either via PHP ?Type or explicit nullable: true), preventing database constraint violations when embeddables are set to null
    3. Nested Embeddables: Validates that embedded objects with explicit non-null default values are nullable (uninitialized properties are allowed)

Installation

  • Automatic: Works via phpstan/extension-installer (already in dev dependencies)
  • Manual: Add vendor/andanteproject/nullable-embeddable-bundle/extension.neon to your PHPStan config

Why This Matters

This extension helps developers catch configuration errors before runtime that would otherwise cause:

  • Database integrity constraint violations (NOT NULL column errors)
  • Phantom entity updates in Doctrine's UnitOfWork
  • Difficult-to-debug hydration issues

Strongly recommended for all projects using this bundle.

Full Changelog: v1.0.0...v1.0.1