What's Changed
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
DataTransformerand overridden thecreate()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