Skip to content

v0.6.0

Latest

Choose a tag to compare

@surgiie surgiie released this 23 Nov 23:49
· 4 commits to master since this release
c417280

What's Changed

  • ci: add phpstan, pint and contributing. by @surgiie in #17

Fixes issues phpstan compatability and proper usages for inheritance:

  • PHPStan 2.0 compatibility issues
  • Fixed "unsafe usage of new static()" error
  • Fixed encapsed string type errors in exception messages
  • Improved type hints for better static analysis

Potential Breaking Changes

Return Type Change in DataTransformer::create()

The return type of DataTransformer::create() has been changed from DataTransformer to static to support proper inheritance and fix PHPStan compatibility issues.

Who is affected:

  • Only users who have extended DataTransformer and overridden the create() method

Migration:
If you have code like this:

class MyTransformer extends DataTransformer
{
    public static function create($data, $callables): DataTransformer
    {
        // your implementation
    }
}

Change it to type hint static instead:

  class MyTransformer extends DataTransformer
  {
      public static function create($data, $callables): static
      {
          // your implementation
      }
  }

Why this change:

This change ensures that child classes return their own type instead of the parent type, enabling proper method chaining and type safety when extending DataTransformer making inheritance consistent.

Full Changelog: v0.5.0...v0.6.0