Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Reacter model's hasReactedTo & hasNotReactedTo methods signature #111

Merged
merged 2 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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