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

Code style fix #243

Merged
merged 1 commit into from
Apr 4, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions contracts/Reactable/Exceptions/ReactableInvalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public static function classNotExists(
return new self(
sprintf(
'[%s] class or morph map not found.',
$type
)
$type,
),
);
}

Expand All @@ -38,8 +38,8 @@ public static function notImplementInterface(
sprintf(
'[%s] must implement `%s` contract.',
$type,
Reactable::class
)
Reactable::class,
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static function ofTypeForReactant(
sprintf(
'ReactionCounter for Reactant `%s` with ReactionType `%s` already exists.',
$reactant->getId(),
$reactionType->getId()
)
$reactionType->getId(),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public static function forReactant(
return new self(
sprintf(
'ReactionTotal for Reactant `%s` already exists.',
$reactant->getId()
)
$reactant->getId(),
),
);
}
}
8 changes: 4 additions & 4 deletions contracts/Reacterable/Exceptions/ReacterableInvalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public static function classNotExists(
return new self(
sprintf(
'[%s] class or morph map not found.',
$type
)
$type,
),
);
}

Expand All @@ -38,8 +38,8 @@ public static function notImplementInterface(
sprintf(
'[%s] must implement `%s` contract.',
$type,
Reacterable::class
)
Reacterable::class,
),
);
}
}
4 changes: 2 additions & 2 deletions contracts/Reaction/Exceptions/RateInvalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static function withSameValue(
return new self(
sprintf(
'Invalid Reaction rate: `%s`. Can not change to same value.',
$rate
)
$rate,
),
);
}
}
4 changes: 2 additions & 2 deletions contracts/Reaction/Exceptions/RateOutOfRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static function withValueBetween(
'Invalid Reaction rate: `%s`. Must be between `%s` and `%s`',
$rate,
$minimumRate,
$maximumRate
)
$maximumRate,
),
);
}
}
4 changes: 2 additions & 2 deletions contracts/Reaction/Exceptions/ReactionAlreadyExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public static function ofType(
return new self(
sprintf(
'Reaction of type `%s` already exists.',
$reactionType->getName()
)
$reactionType->getName(),
),
);
}
}
4 changes: 2 additions & 2 deletions contracts/Reaction/Exceptions/ReactionNotExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public static function ofType(
return new self(
sprintf(
'Reaction of type `%s` not exists.',
$reactionType->getName()
)
$reactionType->getName(),
),
);
}
}
4 changes: 2 additions & 2 deletions contracts/ReactionType/Exceptions/ReactionTypeInvalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static function nameNotExists(
return new self(
sprintf(
'ReactionType with name `%s` not exists.',
$name
)
$name,
),
);
}
}
16 changes: 8 additions & 8 deletions src/Console/Commands/ReactionTypeAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function handle(): int
$this->error(
sprintf(
'Reaction type with name `%s` is invalid.',
$name
)
$name,
),
);

return self::FAILURE;
Expand All @@ -51,8 +51,8 @@ public function handle(): int
$this->error(
sprintf(
'Reaction type with name `%s` already exists.',
$name
)
$name,
),
);

return self::FAILURE;
Expand Down Expand Up @@ -105,8 +105,8 @@ private function createDefaultReactionTypes(): void
$this->line(
sprintf(
'Reaction type with name `%s` already exists.',
$type['name']
)
$type['name'],
),
);
continue;
}
Expand All @@ -128,8 +128,8 @@ private function createReactionType(
sprintf(
'Reaction type with name `%s` and mass `%d` was added.',
$name,
$mass
)
$mass,
),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/Recount.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function handle(
}

$this->warn(
"Rebuilding reaction aggregates using `$queueConnectionName` queue connection."
"Rebuilding reaction aggregates using `$queueConnectionName` queue connection.",
);

$reactants = $this->collectReactants($reactableType);
Expand All @@ -90,7 +90,7 @@ public function handle(
foreach ($reactants as $reactant) {
$this->dispatcher->dispatch(
(new RebuildReactionAggregatesJob($reactant, $reactionType))
->onConnection($queueConnectionName)
->onConnection($queueConnectionName),
);

$this->getOutput()->progressAdvance();
Expand Down
16 changes: 8 additions & 8 deletions src/Console/Commands/SetupReactable.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function handle(
$this->error(
sprintf(
'Model `%s` not exists.',
$model
)
$model,
),
);

return self::FAILURE;
Expand All @@ -68,8 +68,8 @@ public function handle(
$this->error(
sprintf(
'Model `%s` does not implements Reactable interface.',
get_class($model)
)
get_class($model),
),
);

return self::FAILURE;
Expand All @@ -85,8 +85,8 @@ public function handle(
$this->error(
sprintf(
'Referenced table `%s` does not exists in database.',
$referencedTable
)
$referencedTable,
),
);

return self::FAILURE;
Expand All @@ -97,8 +97,8 @@ public function handle(
sprintf(
'Foreign column `%s` already exists in `%s` database table.',
$foreignColumn,
$table
)
$table,
),
);

return self::FAILURE;
Expand Down
16 changes: 8 additions & 8 deletions src/Console/Commands/SetupReacterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function handle(
$this->error(
sprintf(
'Model `%s` not exists.',
$model
)
$model,
),
);

return self::FAILURE;
Expand All @@ -68,8 +68,8 @@ public function handle(
$this->error(
sprintf(
'Model `%s` does not implements Reacterable interface.',
get_class($model)
)
get_class($model),
),
);

return self::FAILURE;
Expand All @@ -85,8 +85,8 @@ public function handle(
$this->error(
sprintf(
'Referenced table `%s` does not exists in database.',
$referencedTable
)
$referencedTable,
),
);

return self::FAILURE;
Expand All @@ -97,8 +97,8 @@ public function handle(
sprintf(
'Foreign column `%s` already exists in `%s` database table.',
$foreignColumn,
$table
)
$table,
),
);

return self::FAILURE;
Expand Down
6 changes: 4 additions & 2 deletions src/Reactable/Observers/ReactableObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ final class ReactableObserver
public function created(
ReactableInterface $reactable,
): void {
if ($this->shouldRegisterAsReactantOnCreate($reactable)
&& $reactable->isNotRegisteredAsLoveReactant()) {
if (
$this->shouldRegisterAsReactantOnCreate($reactable)
&& $reactable->isNotRegisteredAsLoveReactant()
) {
$reactable->registerAsLoveReactant();
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Reactant/Facades/Reactant.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getReactionCounterOfType(
string $reactionTypeName,
): ReactionCounterInterface {
return $this->reactant->getReactionCounterOfType(
ReactionType::fromName($reactionTypeName)
ReactionType::fromName($reactionTypeName),
);
}

Expand All @@ -74,7 +74,7 @@ public function isReactedBy(
return $this->reactant->isReactedBy(
$reacterable->getLoveReacter(),
$reactionType,
$rate
$rate,
);
}

Expand All @@ -92,7 +92,7 @@ public function isNotReactedBy(
return $this->reactant->isNotReactedBy(
$reacterable->getLoveReacter(),
$reactionType,
$rate
$rate,
);
}
}
2 changes: 1 addition & 1 deletion src/Reactant/Listeners/DecrementAggregates.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(
$reactant = $reaction->getReactant();

$this->dispatcher->dispatch(
new DecrementReactionAggregatesJob($reactant, $reaction)
new DecrementReactionAggregatesJob($reactant, $reaction),
);
}
}
2 changes: 1 addition & 1 deletion src/Reactant/Listeners/IncrementAggregates.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(
$reactant = $reaction->getReactant();

$this->dispatcher->dispatch(
new IncrementReactionAggregatesJob($reactant, $reaction)
new IncrementReactionAggregatesJob($reactant, $reaction),
);
}
}
8 changes: 4 additions & 4 deletions src/Reacter/Facades/Reacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function reactTo(
$this->reacter->reactTo(
$reactable->getLoveReactant(),
ReactionType::fromName($reactionTypeName),
$rate
$rate,
);
}

Expand All @@ -55,7 +55,7 @@ public function unreactTo(
): void {
$this->reacter->unreactTo(
$reactable->getLoveReactant(),
ReactionType::fromName($reactionTypeName)
ReactionType::fromName($reactionTypeName),
);
}

Expand All @@ -69,7 +69,7 @@ public function hasReactedTo(
return $this->reacter->hasReactedTo(
$reactable->getLoveReactant(),
$reactionType,
$rate
$rate,
);
}

Expand All @@ -83,7 +83,7 @@ public function hasNotReactedTo(
return $this->reacter->hasNotReactedTo(
$reactable->getLoveReactant(),
$reactionType,
$rate
$rate,
);
}
}
6 changes: 4 additions & 2 deletions src/Reacterable/Observers/ReacterableObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ final class ReacterableObserver
public function created(
ReacterableInterface $reacterable,
): void {
if ($this->shouldRegisterAsReacterOnCreate($reacterable)
&& $reacterable->isNotRegisteredAsLoveReacter()) {
if (
$this->shouldRegisterAsReacterOnCreate($reacterable)
&& $reacterable->isNotRegisteredAsLoveReacter()
) {
$reacterable->registerAsLoveReacter();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Reaction/Observers/ReactionObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public function created(
Reaction $reaction,
): void {
$this->eventDispatcher->dispatch(
new ReactionHasBeenAdded($reaction)
new ReactionHasBeenAdded($reaction),
);
}

public function deleted(
Reaction $reaction,
): void {
$this->eventDispatcher->dispatch(
new ReactionHasBeenRemoved($reaction)
new ReactionHasBeenRemoved($reaction),
);
}
}