Added
PHPStan Extension
- NEW: PHPStan static analysis extension to validate
#[NullableEmbeddable]classes and prevent common runtime errors - The extension automatically validates three critical rules:
- Property Initialization: Flags properties with non-null default values outside the constructor (e.g.,
private bool $enabled = false;), which cause Doctrine hydration issues - Nullable Columns: Ensures all
#[Column]mappings are nullable (either via PHP?Typeor explicitnullable: true), preventing database constraint violations when embeddables are set to null - Nested Embeddables: Validates that embedded objects with explicit non-null default values are nullable (uninitialized properties are allowed)
- Property Initialization: Flags properties with non-null default values outside the constructor (e.g.,
Installation
- Automatic: Works via
phpstan/extension-installer(already in dev dependencies) - Manual: Add
vendor/andanteproject/nullable-embeddable-bundle/extension.neonto 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