diff --git a/CHANGELOG.md b/CHANGELOG.md index dc8a073..f4c9652 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/laravel-utils/releases). ## Unreleased +## v10.9.0 + +### Added + +- Force usage of `Illuminate\Database\Eloquent\Relations\HasOneOrMany::chaperone()` over its alias `inverse()` via PHPStan rule https://github.com/mll-lab/laravel-utils/pull/39 + ## v10.8.0 ### Changed diff --git a/rules.neon b/rules.neon index dde992d..b0a0074 100644 --- a/rules.neon +++ b/rules.neon @@ -8,6 +8,9 @@ parameters: - method: 'Illuminate\Database\Eloquent\Model::update()' message: 'it assigns attributes through an array and is not type safe, without parameters it is like save().' errorTip: 'Assign attributes through property assignment, then call save(). If your intention was to not save new models, check $exists explicitly.' + - method: 'Illuminate\Database\Eloquent\Relations\HasOneOrMany::inverse()' + message: 'it is an alias for chaperone().' + errorTip: 'Use chaperone() instead.' - method: 'Illuminate\Database\Eloquent\Factories\Factory::createOne()' message: 'creating or filling models through arrays prevents static validation from working.' errorTip: 'Call createOne() without any parameters, use property assignment to fill the model.'