Skip to content

Commit

Permalink
Fix Reacter model's hasReactedTo & hasNotReactedTo methods signature (#…
Browse files Browse the repository at this point in the history
…111)

Fix Reacter model's hasReactedTo & hasNotReactedTo methods signature
  • Loading branch information
antonkomarev authored Sep 3, 2019
1 parent 2d479d7 commit 7c1b0c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions contracts/Reacter/Models/Reacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/Reacter/Models/NullReacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public function unreactTo(
public function hasReactedTo(
Reactant $reactant,
?ReactionType $reactionType = null,
float $rate = null
?float $rate = null
): bool {
return false;
}

public function hasNotReactedTo(
Reactant $reactant,
?ReactionType $reactionType = null,
float $rate = null
?float $rate = null
): bool {
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Reacter/Models/Reacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 7c1b0c8

Please sign in to comment.