Skip to content

v1.8.1 Quality Hardening

Choose a tag to compare

@CreativeNative CreativeNative released this 08 Feb 21:37
· 35 commits to master since this release

What's New

This release hardens the codebase to the highest quality bar — PHPStan level max with zero errors, 100% line coverage, and strict PHPUnit mode — all without changing any runtime behavior.

Static Analysis: PHPStan Level Max

  • Zero errors at level max — reduced from 917 errors to 0 across src/ and tests/
  • Zero @phpstan-ignore annotations — every error fixed at the root cause using assertion-based narrowing
  • phpstan-doctrine formalized in require-dev for Doctrine metadata type awareness
  • Config locked: level: max in phpstan.neon, single composer stan command

Type Safety

  • Handler chain verified: All 10 handlers have explicit type narrowing at every getDataToBeTranslated(), getProperty(), and getTranslatedParent() call site
  • ORM 3 typed API migration: All handler association access uses instanceof InverseSideMapping/OwningSideMapping with typed property syntax ($assoc->mappedBy) instead of array syntax
  • Interface coupling: Handlers depend only on EntityTranslatorInterface, removed concrete class downcasts
  • DI extension: Typed array shape for processConfiguration() return, simplified logging config access

Test Quality

  • 293 tests, 2101 assertions — up from 275 tests, 2012 assertions
  • Strict mode: failOnWarning, failOnNotice, failOnRisky all enabled — zero violations
  • 100% line coverage: 813/813 lines, 153/153 methods, 29/29 classes
  • CI enforcement: Coverage threshold raised from 95% to 100%

PHPDoc Improvements

  • TranslatableInterface::getTranslations() return type narrowed to array<string, array<string, mixed>>
  • TranslatableTrait::$translations property type narrowed to match
  • Typed accessor methods on test base classes for null-safe property access
  • EntityTranslatorInterface enhanced with full @param/@return PHPDoc

Internal

  • 37 atomic commits across 13 plans in 5 phases
  • PHPUnit mock notices resolved with #[AllowMockObjectsWithoutExpectations] attribute
  • ReflectionMethod::invoke() replaces variable method calls for strict mode compliance
  • Stale @var annotations, dead imports, and unused code removed

Full Changelog: v1.8.0...v1.8.1