laravel-json-api / eloquent

Serialize Eloquent models to JSON API resources
MIT License
12 stars 15 forks source link

these methods should have a return type of 'self' #31

Closed ennorehling closed 8 months ago

ennorehling commented 8 months ago

When a method returns $this, it should be declared with a return type of self, especially on an interface or trait.

This makes static analysis tools like phan happy.

lindyhopchris commented 8 months ago

Thanks for the PR. I'm doing some open source work later this week to prep for the Laravel 11 release, so will look at getting this merged and tagged then.

lindyhopchris commented 8 months ago

@ennorehling thanks for this PR - I've pushed some additional changes that were missed.

Under semver, this is a major change. If anyone has extended these classes, changing the return type like this could cause their code to break.

As I'm about to do a major release for Laravel 11, I'm going to include it in that release.