From 06c565b17d06d9a96eb8bb0d5a388158e72c7ce3 Mon Sep 17 00:00:00 2001 From: Anton Komarev Date: Tue, 4 Apr 2023 22:15:40 +0300 Subject: [PATCH] Code style fix --- .../Reactable/Exceptions/ReactableInvalid.php | 8 ++++---- .../Exceptions/ReactionCounterDuplicate.php | 4 ++-- .../Exceptions/ReactionTotalDuplicate.php | 4 ++-- .../Exceptions/ReacterableInvalid.php | 8 ++++---- contracts/Reaction/Exceptions/RateInvalid.php | 4 ++-- contracts/Reaction/Exceptions/RateOutOfRange.php | 4 ++-- .../Exceptions/ReactionAlreadyExists.php | 4 ++-- .../Reaction/Exceptions/ReactionNotExists.php | 4 ++-- .../Exceptions/ReactionTypeInvalid.php | 4 ++-- src/Console/Commands/ReactionTypeAdd.php | 16 ++++++++-------- src/Console/Commands/Recount.php | 4 ++-- src/Console/Commands/SetupReactable.php | 16 ++++++++-------- src/Console/Commands/SetupReacterable.php | 16 ++++++++-------- src/Reactable/Observers/ReactableObserver.php | 6 ++++-- src/Reactant/Facades/Reactant.php | 6 +++--- src/Reactant/Listeners/DecrementAggregates.php | 2 +- src/Reactant/Listeners/IncrementAggregates.php | 2 +- src/Reacter/Facades/Reacter.php | 8 ++++---- .../Observers/ReacterableObserver.php | 6 ++++-- src/Reaction/Observers/ReactionObserver.php | 4 ++-- src/Support/Database/MigrationCreator.php | 2 +- 21 files changed, 68 insertions(+), 64 deletions(-) diff --git a/contracts/Reactable/Exceptions/ReactableInvalid.php b/contracts/Reactable/Exceptions/ReactableInvalid.php index 082f0ecc..3de6813c 100644 --- a/contracts/Reactable/Exceptions/ReactableInvalid.php +++ b/contracts/Reactable/Exceptions/ReactableInvalid.php @@ -26,8 +26,8 @@ public static function classNotExists( return new self( sprintf( '[%s] class or morph map not found.', - $type - ) + $type, + ), ); } @@ -38,8 +38,8 @@ public static function notImplementInterface( sprintf( '[%s] must implement `%s` contract.', $type, - Reactable::class - ) + Reactable::class, + ), ); } } diff --git a/contracts/Reactant/ReactionCounter/Exceptions/ReactionCounterDuplicate.php b/contracts/Reactant/ReactionCounter/Exceptions/ReactionCounterDuplicate.php index aed8a615..7c858e7b 100644 --- a/contracts/Reactant/ReactionCounter/Exceptions/ReactionCounterDuplicate.php +++ b/contracts/Reactant/ReactionCounter/Exceptions/ReactionCounterDuplicate.php @@ -29,8 +29,8 @@ public static function ofTypeForReactant( sprintf( 'ReactionCounter for Reactant `%s` with ReactionType `%s` already exists.', $reactant->getId(), - $reactionType->getId() - ) + $reactionType->getId(), + ), ); } } diff --git a/contracts/Reactant/ReactionTotal/Exceptions/ReactionTotalDuplicate.php b/contracts/Reactant/ReactionTotal/Exceptions/ReactionTotalDuplicate.php index d2fd291a..21b48f33 100644 --- a/contracts/Reactant/ReactionTotal/Exceptions/ReactionTotalDuplicate.php +++ b/contracts/Reactant/ReactionTotal/Exceptions/ReactionTotalDuplicate.php @@ -26,8 +26,8 @@ public static function forReactant( return new self( sprintf( 'ReactionTotal for Reactant `%s` already exists.', - $reactant->getId() - ) + $reactant->getId(), + ), ); } } diff --git a/contracts/Reacterable/Exceptions/ReacterableInvalid.php b/contracts/Reacterable/Exceptions/ReacterableInvalid.php index 9d8b505c..afd17b87 100644 --- a/contracts/Reacterable/Exceptions/ReacterableInvalid.php +++ b/contracts/Reacterable/Exceptions/ReacterableInvalid.php @@ -26,8 +26,8 @@ public static function classNotExists( return new self( sprintf( '[%s] class or morph map not found.', - $type - ) + $type, + ), ); } @@ -38,8 +38,8 @@ public static function notImplementInterface( sprintf( '[%s] must implement `%s` contract.', $type, - Reacterable::class - ) + Reacterable::class, + ), ); } } diff --git a/contracts/Reaction/Exceptions/RateInvalid.php b/contracts/Reaction/Exceptions/RateInvalid.php index 03ca7541..391b0ba5 100644 --- a/contracts/Reaction/Exceptions/RateInvalid.php +++ b/contracts/Reaction/Exceptions/RateInvalid.php @@ -25,8 +25,8 @@ public static function withSameValue( return new self( sprintf( 'Invalid Reaction rate: `%s`. Can not change to same value.', - $rate - ) + $rate, + ), ); } } diff --git a/contracts/Reaction/Exceptions/RateOutOfRange.php b/contracts/Reaction/Exceptions/RateOutOfRange.php index 67790d63..23692ac8 100644 --- a/contracts/Reaction/Exceptions/RateOutOfRange.php +++ b/contracts/Reaction/Exceptions/RateOutOfRange.php @@ -29,8 +29,8 @@ public static function withValueBetween( 'Invalid Reaction rate: `%s`. Must be between `%s` and `%s`', $rate, $minimumRate, - $maximumRate - ) + $maximumRate, + ), ); } } diff --git a/contracts/Reaction/Exceptions/ReactionAlreadyExists.php b/contracts/Reaction/Exceptions/ReactionAlreadyExists.php index aa209afc..71843ccb 100644 --- a/contracts/Reaction/Exceptions/ReactionAlreadyExists.php +++ b/contracts/Reaction/Exceptions/ReactionAlreadyExists.php @@ -26,8 +26,8 @@ public static function ofType( return new self( sprintf( 'Reaction of type `%s` already exists.', - $reactionType->getName() - ) + $reactionType->getName(), + ), ); } } diff --git a/contracts/Reaction/Exceptions/ReactionNotExists.php b/contracts/Reaction/Exceptions/ReactionNotExists.php index c1fd0445..1a8ef8f5 100644 --- a/contracts/Reaction/Exceptions/ReactionNotExists.php +++ b/contracts/Reaction/Exceptions/ReactionNotExists.php @@ -26,8 +26,8 @@ public static function ofType( return new self( sprintf( 'Reaction of type `%s` not exists.', - $reactionType->getName() - ) + $reactionType->getName(), + ), ); } } diff --git a/contracts/ReactionType/Exceptions/ReactionTypeInvalid.php b/contracts/ReactionType/Exceptions/ReactionTypeInvalid.php index e9ae6379..c8087060 100644 --- a/contracts/ReactionType/Exceptions/ReactionTypeInvalid.php +++ b/contracts/ReactionType/Exceptions/ReactionTypeInvalid.php @@ -25,8 +25,8 @@ public static function nameNotExists( return new self( sprintf( 'ReactionType with name `%s` not exists.', - $name - ) + $name, + ), ); } } diff --git a/src/Console/Commands/ReactionTypeAdd.php b/src/Console/Commands/ReactionTypeAdd.php index ccfdcd06..93f12b78 100644 --- a/src/Console/Commands/ReactionTypeAdd.php +++ b/src/Console/Commands/ReactionTypeAdd.php @@ -40,8 +40,8 @@ public function handle(): int $this->error( sprintf( 'Reaction type with name `%s` is invalid.', - $name - ) + $name, + ), ); return self::FAILURE; @@ -51,8 +51,8 @@ public function handle(): int $this->error( sprintf( 'Reaction type with name `%s` already exists.', - $name - ) + $name, + ), ); return self::FAILURE; @@ -105,8 +105,8 @@ private function createDefaultReactionTypes(): void $this->line( sprintf( 'Reaction type with name `%s` already exists.', - $type['name'] - ) + $type['name'], + ), ); continue; } @@ -128,8 +128,8 @@ private function createReactionType( sprintf( 'Reaction type with name `%s` and mass `%d` was added.', $name, - $mass - ) + $mass, + ), ); } diff --git a/src/Console/Commands/Recount.php b/src/Console/Commands/Recount.php index 5a18b883..d694fd75 100644 --- a/src/Console/Commands/Recount.php +++ b/src/Console/Commands/Recount.php @@ -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); @@ -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(); diff --git a/src/Console/Commands/SetupReactable.php b/src/Console/Commands/SetupReactable.php index a41c256a..2b239c3a 100644 --- a/src/Console/Commands/SetupReactable.php +++ b/src/Console/Commands/SetupReactable.php @@ -54,8 +54,8 @@ public function handle( $this->error( sprintf( 'Model `%s` not exists.', - $model - ) + $model, + ), ); return self::FAILURE; @@ -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; @@ -85,8 +85,8 @@ public function handle( $this->error( sprintf( 'Referenced table `%s` does not exists in database.', - $referencedTable - ) + $referencedTable, + ), ); return self::FAILURE; @@ -97,8 +97,8 @@ public function handle( sprintf( 'Foreign column `%s` already exists in `%s` database table.', $foreignColumn, - $table - ) + $table, + ), ); return self::FAILURE; diff --git a/src/Console/Commands/SetupReacterable.php b/src/Console/Commands/SetupReacterable.php index 9ed4ec45..026489fa 100644 --- a/src/Console/Commands/SetupReacterable.php +++ b/src/Console/Commands/SetupReacterable.php @@ -54,8 +54,8 @@ public function handle( $this->error( sprintf( 'Model `%s` not exists.', - $model - ) + $model, + ), ); return self::FAILURE; @@ -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; @@ -85,8 +85,8 @@ public function handle( $this->error( sprintf( 'Referenced table `%s` does not exists in database.', - $referencedTable - ) + $referencedTable, + ), ); return self::FAILURE; @@ -97,8 +97,8 @@ public function handle( sprintf( 'Foreign column `%s` already exists in `%s` database table.', $foreignColumn, - $table - ) + $table, + ), ); return self::FAILURE; diff --git a/src/Reactable/Observers/ReactableObserver.php b/src/Reactable/Observers/ReactableObserver.php index bfe947f7..63522e05 100644 --- a/src/Reactable/Observers/ReactableObserver.php +++ b/src/Reactable/Observers/ReactableObserver.php @@ -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(); } } diff --git a/src/Reactant/Facades/Reactant.php b/src/Reactant/Facades/Reactant.php index 7f826bda..50c0b8db 100644 --- a/src/Reactant/Facades/Reactant.php +++ b/src/Reactant/Facades/Reactant.php @@ -51,7 +51,7 @@ public function getReactionCounterOfType( string $reactionTypeName, ): ReactionCounterInterface { return $this->reactant->getReactionCounterOfType( - ReactionType::fromName($reactionTypeName) + ReactionType::fromName($reactionTypeName), ); } @@ -74,7 +74,7 @@ public function isReactedBy( return $this->reactant->isReactedBy( $reacterable->getLoveReacter(), $reactionType, - $rate + $rate, ); } @@ -92,7 +92,7 @@ public function isNotReactedBy( return $this->reactant->isNotReactedBy( $reacterable->getLoveReacter(), $reactionType, - $rate + $rate, ); } } diff --git a/src/Reactant/Listeners/DecrementAggregates.php b/src/Reactant/Listeners/DecrementAggregates.php index 9c5294a6..242637c4 100644 --- a/src/Reactant/Listeners/DecrementAggregates.php +++ b/src/Reactant/Listeners/DecrementAggregates.php @@ -34,7 +34,7 @@ public function handle( $reactant = $reaction->getReactant(); $this->dispatcher->dispatch( - new DecrementReactionAggregatesJob($reactant, $reaction) + new DecrementReactionAggregatesJob($reactant, $reaction), ); } } diff --git a/src/Reactant/Listeners/IncrementAggregates.php b/src/Reactant/Listeners/IncrementAggregates.php index 7bde75d8..f8578856 100644 --- a/src/Reactant/Listeners/IncrementAggregates.php +++ b/src/Reactant/Listeners/IncrementAggregates.php @@ -34,7 +34,7 @@ public function handle( $reactant = $reaction->getReactant(); $this->dispatcher->dispatch( - new IncrementReactionAggregatesJob($reactant, $reaction) + new IncrementReactionAggregatesJob($reactant, $reaction), ); } } diff --git a/src/Reacter/Facades/Reacter.php b/src/Reacter/Facades/Reacter.php index 93ee2194..834668f0 100644 --- a/src/Reacter/Facades/Reacter.php +++ b/src/Reacter/Facades/Reacter.php @@ -45,7 +45,7 @@ public function reactTo( $this->reacter->reactTo( $reactable->getLoveReactant(), ReactionType::fromName($reactionTypeName), - $rate + $rate, ); } @@ -55,7 +55,7 @@ public function unreactTo( ): void { $this->reacter->unreactTo( $reactable->getLoveReactant(), - ReactionType::fromName($reactionTypeName) + ReactionType::fromName($reactionTypeName), ); } @@ -69,7 +69,7 @@ public function hasReactedTo( return $this->reacter->hasReactedTo( $reactable->getLoveReactant(), $reactionType, - $rate + $rate, ); } @@ -83,7 +83,7 @@ public function hasNotReactedTo( return $this->reacter->hasNotReactedTo( $reactable->getLoveReactant(), $reactionType, - $rate + $rate, ); } } diff --git a/src/Reacterable/Observers/ReacterableObserver.php b/src/Reacterable/Observers/ReacterableObserver.php index caaf87f0..b097310f 100644 --- a/src/Reacterable/Observers/ReacterableObserver.php +++ b/src/Reacterable/Observers/ReacterableObserver.php @@ -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(); } } diff --git a/src/Reaction/Observers/ReactionObserver.php b/src/Reaction/Observers/ReactionObserver.php index d41d4baf..f4c2f6d8 100644 --- a/src/Reaction/Observers/ReactionObserver.php +++ b/src/Reaction/Observers/ReactionObserver.php @@ -40,7 +40,7 @@ public function created( Reaction $reaction, ): void { $this->eventDispatcher->dispatch( - new ReactionHasBeenAdded($reaction) + new ReactionHasBeenAdded($reaction), ); } @@ -48,7 +48,7 @@ public function deleted( Reaction $reaction, ): void { $this->eventDispatcher->dispatch( - new ReactionHasBeenRemoved($reaction) + new ReactionHasBeenRemoved($reaction), ); } } diff --git a/src/Support/Database/MigrationCreator.php b/src/Support/Database/MigrationCreator.php index 29e1064a..af64b7c0 100644 --- a/src/Support/Database/MigrationCreator.php +++ b/src/Support/Database/MigrationCreator.php @@ -39,7 +39,7 @@ public function create( $this->files->put( $this->getPath($basePath, $migrationStub->getFilename()), - $migrationStub->getPopulatedContent() + $migrationStub->getPopulatedContent(), ); }