Skip to content

1.16.0

Choose a tag to compare

@koriym koriym released this 19 Nov 14:24
· 33 commits to 1.x since this release
3883f92

Parameter-level Attributes for Ray.Di 2.19.1

Summary

This release migrates Ray.AuraSqlModule to use parameter-level attributes for dependency injection, ensuring compatibility with Ray.Di 2.19.1.

Breaking Changes

⚠️ Requires Ray.Di ^2.19.1 and Ray.Aop ^2.19

Ray.Di 2.19.0 removed method-level attribute support for qualified parameters. This release migrates all qualifier attributes to parameter-level, aligning with PHP 8's native attribute targeting.

Changes

Attribute Definitions

Updated qualifier attributes to target parameters instead of methods:

  • AuraSqlQueryConfig: TARGET_METHOD → TARGET_PARAMETER
  • EnvAuth: TARGET_METHOD → TARGET_PARAMETER
  • PagerViewOption: TARGET_PARAMETER, made $value optional
  • Test fixtures updated accordingly

Module Configuration

Enhanced Validation

  • NamedPdoModule now validates non-empty qualifiers in constructor
    • Throws InvalidArgumentException with clear error message
    • Directs users to AuraSqlModule for unqualified bindings
    • Simplified internal logic

Array Format for toConstructor

Migrated from legacy string format to array format:

// Before
'dsn=pdo_dsn,username=pdo_user'

// After
['dsn' => 'pdo_dsn', 'username' => 'pdo_user']

Bug Fixes

  • Fixed NamedPdoModule to properly pass $options and $queries parameters to ExtendedPdo
  • Added missing driver_options and after_connect parameter bindings

Code Quality Improvements

  • Eliminated conditional binding anti-patterns via method splitting
  • Separate methods for qualified/unqualified configuration paths
  • Improved PHPStan compatibility with type-safe qualifier handling
  • Better code maintainability and readability

Testing

  • Added test coverage for empty qualifier validation
  • All 76 tests passing with 145 assertions
  • PHPStan, PHPCS, and Psalm checks passing

Cleanup

  • Removed deprecated ServiceLocator setup from tests
  • Removed coverage configuration from phpunit.xml.dist
  • Coverage now generated only when explicitly requested

Migration Guide

If you're using Ray.Di < 2.19.1, update your dependencies:

composer require ray/di:^2.19.1 ray/aop:^2.19

No code changes required in your application - the attribute migration is internal to the module.

Related

  • Depends on ray-di/Ray.Di#306 (Ray.Di 2.19.1)
  • Part of Ray.MediaQuery 1.0 preparation