diff --git a/CHANGELOG.md b/CHANGELOG.md index 59372fc5..d6a018c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ All notable changes to `laravel-love` will be documented in this file. - ([#110]) Renamed `withValue` method to `withValueBetween` in `RateOutOfRange` exception - ([#110]) Added `$minimumRate` parameter to `withValueBetween` method in `RateOutOfRange` exception - ([#110]) Added `$maximumRate` parameter to `withValueBetween` method in `RateOutOfRange` exception +- ([#111]) Changed `$rate` parameter type from `float` to `?float` of `hasReactedTo` method in `Reacter` model contract +- ([#111]) Changed `$rate` parameter type from `float` to `?float` of `hasNotReactedTo` method in `Reacter` model contract ## [8.0.0] - 2019-08-08 @@ -407,6 +409,7 @@ Follow [upgrade instructions](UPGRADING.md#from-v5-to-v6) to migrate database to [1.1.1]: https://github.com/cybercog/laravel-love/compare/1.1.0...1.1.1 [1.1.0]: https://github.com/cybercog/laravel-love/compare/1.0.0...1.1.0 +[#111]: https://github.com/cybercog/laravel-love/pull/111 [#110]: https://github.com/cybercog/laravel-love/pull/110 [#102]: https://github.com/cybercog/laravel-love/pull/102 [#100]: https://github.com/cybercog/laravel-love/pull/100 diff --git a/contracts/Reacter/Models/Reacter.php b/contracts/Reacter/Models/Reacter.php index 187eceaf..f26d2692 100644 --- a/contracts/Reacter/Models/Reacter.php +++ b/contracts/Reacter/Models/Reacter.php @@ -32,9 +32,9 @@ public function reactTo(Reactant $reactant, ReactionType $reactionType, ?float $ public function unreactTo(Reactant $reactant, ReactionType $reactionType): void; - public function hasReactedTo(Reactant $reactant, ?ReactionType $reactionType = null, float $rate = null): bool; + public function hasReactedTo(Reactant $reactant, ?ReactionType $reactionType = null, ?float $rate = null): bool; - public function hasNotReactedTo(Reactant $reactant, ?ReactionType $reactionType = null, float $rate = null): bool; + public function hasNotReactedTo(Reactant $reactant, ?ReactionType $reactionType = null, ?float $rate = null): bool; public function isEqualTo(self $that): bool; diff --git a/src/Reacter/Models/NullReacter.php b/src/Reacter/Models/NullReacter.php index fa58f215..db2efbc4 100644 --- a/src/Reacter/Models/NullReacter.php +++ b/src/Reacter/Models/NullReacter.php @@ -65,7 +65,7 @@ public function unreactTo( public function hasReactedTo( Reactant $reactant, ?ReactionType $reactionType = null, - float $rate = null + ?float $rate = null ): bool { return false; } @@ -73,7 +73,7 @@ public function hasReactedTo( public function hasNotReactedTo( Reactant $reactant, ?ReactionType $reactionType = null, - float $rate = null + ?float $rate = null ): bool { return true; } diff --git a/src/Reacter/Models/Reacter.php b/src/Reacter/Models/Reacter.php index 4d3e55dc..9ac2b10a 100644 --- a/src/Reacter/Models/Reacter.php +++ b/src/Reacter/Models/Reacter.php @@ -121,7 +121,7 @@ public function unreactTo( public function hasReactedTo( ReactantContract $reactant, ?ReactionTypeContract $reactionType = null, - float $rate = null + ?float $rate = null ): bool { if ($reactant->isNull()) { return false; @@ -133,7 +133,7 @@ public function hasReactedTo( public function hasNotReactedTo( ReactantContract $reactant, ?ReactionTypeContract $reactionType = null, - float $rate = null + ?float $rate = null ): bool { return $reactant->isNotReactedBy($this, $reactionType, $rate); } @@ -164,7 +164,7 @@ public function isNotNull(): bool private function createReaction( ReactantContract $reactant, ReactionTypeContract $reactionType, - ?float $rate + ?float $rate = null ): void { $this->reactions()->create([ 'reaction_type_id' => $reactionType->getId(),