From 1fb9d875170244ab903f37c59bedd24c183a25a0 Mon Sep 17 00:00:00 2001 From: prolic Date: Wed, 2 Jan 2019 20:55:30 +0800 Subject: [PATCH] rename almost all exceptions requires https://github.com/prooph/event-store/pull/355 --- src/ClientOperations/AbstractOperation.php | 8 ++++---- .../AbstractSubscriptionOperation.php | 18 +++++++++--------- .../AppendToStreamOperation.php | 16 ++++++++-------- .../CommitTransactionOperation.php | 16 ++++++++-------- .../ConditionalAppendToStreamOperation.php | 8 ++++---- ...onnectToPersistentSubscriptionOperation.php | 12 ++++++------ .../CreatePersistentSubscriptionOperation.php | 4 ++-- .../DeletePersistentSubscriptionOperation.php | 4 ++-- src/ClientOperations/DeleteStreamOperation.php | 16 ++++++++-------- .../ReadAllEventsBackwardOperation.php | 4 ++-- .../ReadAllEventsForwardOperation.php | 4 ++-- src/ClientOperations/ReadEventOperation.php | 4 ++-- .../ReadStreamEventsBackwardOperation.php | 4 ++-- .../ReadStreamEventsForwardOperation.php | 4 ++-- .../StartTransactionOperation.php | 16 ++++++++-------- .../TransactionalWriteOperation.php | 4 ++-- .../UpdatePersistentSubscriptionOperation.php | 4 ++-- ...=> PersistentSubscriptionCommandFailed.php} | 4 ++-- ...ption.php => ProjectionCommandConflict.php} | 4 ++-- ...ception.php => ProjectionCommandFailed.php} | 4 ++-- ...edException.php => UserCommandConflict.php} | 4 ++-- ...lictException.php => UserCommandFailed.php} | 4 ++-- .../EventStoreConnectionLogicHandler.php | 14 +++++++------- src/Internal/EventStoreNodeConnection.php | 4 ++-- .../EventStoreStreamCatchUpSubscription.php | 4 ++-- src/Internal/OperationsManager.php | 12 ++++++------ src/Internal/SubscriptionsManager.php | 12 ++++++------ .../PersistentSubscriptionsClient.php | 6 +++--- src/Projections/ProjectionsClient.php | 14 +++++++------- src/UserManagement/UsersClient.php | 14 +++++++------- src/UserManagement/UsersManager.php | 4 ++-- tests/UserManagement/change_password.php | 6 +++--- tests/UserManagement/deleting_a_user.php | 8 ++++---- tests/UserManagement/enable_disable_user.php | 6 +++--- tests/UserManagement/reset_password.php | 6 +++--- tests/UserManagement/updating_a_user.php | 4 ++-- tests/append_to_stream.php | 18 +++++++++--------- .../appending_to_implicitly_created_stream.php | 8 ++++---- ...icitly_created_stream_using_transaction.php | 8 ++++---- ...istent_subscription_with_max_one_client.php | 4 ++-- ...istent_subscription_without_permissions.php | 4 ++-- ..._subscription_group_without_permissions.php | 4 ++-- ...e_persistent_subscription_on_all_stream.php | 4 ++-- ..._subscription_group_without_permissions.php | 4 ++-- tests/deleting_stream.php | 8 ++++---- tests/soft_delete.php | 8 ++++---- tests/transaction.php | 12 ++++++------ ...istent_subscription_without_permissions.php | 4 ++-- tests/when_committing_empty_transaction.php | 4 ++-- .../when_working_with_raw_stream_metadata.php | 8 ++++---- ...with_stream_metadata_as_structured_info.php | 4 ++-- 51 files changed, 191 insertions(+), 191 deletions(-) rename src/Exception/{PersistentSubscriptionCommandFailedException.php => PersistentSubscriptionCommandFailed.php} (88%) rename src/Exception/{UserCommandFailedException.php => ProjectionCommandConflict.php} (84%) rename src/Exception/{UserCommandConflictException.php => ProjectionCommandFailed.php} (84%) rename src/Exception/{ProjectionCommandFailedException.php => UserCommandConflict.php} (83%) rename src/Exception/{ProjectionCommandConflictException.php => UserCommandFailed.php} (82%) diff --git a/src/ClientOperations/AbstractOperation.php b/src/ClientOperations/AbstractOperation.php index c2073054..1926029a 100644 --- a/src/ClientOperations/AbstractOperation.php +++ b/src/ClientOperations/AbstractOperation.php @@ -16,9 +16,9 @@ use Amp\Deferred; use Amp\Promise; use Prooph\EventStore\EndPoint; -use Prooph\EventStore\Exception\NotAuthenticatedException; +use Prooph\EventStore\Exception\NotAuthenticated; use Prooph\EventStore\Exception\ServerError; -use Prooph\EventStore\Exception\UnexpectedCommandException; +use Prooph\EventStore\Exception\UnexpectedCommand; use Prooph\EventStore\UserCredentials; use Prooph\EventStoreClient\Messages\ClientMessages\NotHandled; use Prooph\EventStoreClient\Messages\ClientMessages\NotHandled_MasterInfo as MasterInfo; @@ -138,7 +138,7 @@ public function fail(Throwable $exception): void private function inspectNotAuthenticated(TcpPackage $package): InspectionResult { - $this->fail(new NotAuthenticatedException()); + $this->fail(new NotAuthenticated()); return new InspectionResult(InspectionDecision::endOperation(), 'Not authenticated'); } @@ -200,7 +200,7 @@ private function inspectUnexpectedCommand(TcpPackage $package, TcpCommand $expec $this->log->error('TcpPackage Data Dump:'); $this->log->error($package->data()); - $exception = UnexpectedCommandException::with($expectedCommand->name(), $package->command()->name()); + $exception = UnexpectedCommand::with($expectedCommand->name(), $package->command()->name()); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), $exception->getMessage()); diff --git a/src/ClientOperations/AbstractSubscriptionOperation.php b/src/ClientOperations/AbstractSubscriptionOperation.php index 6538f295..e4098c72 100644 --- a/src/ClientOperations/AbstractSubscriptionOperation.php +++ b/src/ClientOperations/AbstractSubscriptionOperation.php @@ -20,12 +20,12 @@ use Generator; use Prooph\EventStore\EndPoint; use Prooph\EventStore\EventStoreSubscription; -use Prooph\EventStore\Exception\AccessDeniedException; -use Prooph\EventStore\Exception\ConnectionClosedException; -use Prooph\EventStore\Exception\NotAuthenticatedException; +use Prooph\EventStore\Exception\AccessDenied; +use Prooph\EventStore\Exception\ConnectionClosed; +use Prooph\EventStore\Exception\NotAuthenticated; use Prooph\EventStore\Exception\RuntimeException; use Prooph\EventStore\Exception\ServerError; -use Prooph\EventStore\Exception\UnexpectedCommandException; +use Prooph\EventStore\Exception\UnexpectedCommand; use Prooph\EventStore\Internal\ResolvedEvent; use Prooph\EventStore\SubscriptionDropReason; use Prooph\EventStore\UserCredentials; @@ -155,7 +155,7 @@ public function inspectPackage(TcpPackage $package): InspectionResult $this->dropSubscription(SubscriptionDropReason::userInitiated(), null); break; case SubscriptionDropReasonMessage::AccessDenied: - $this->dropSubscription(SubscriptionDropReason::accessDenied(), new AccessDeniedException(\sprintf( + $this->dropSubscription(SubscriptionDropReason::accessDenied(), new AccessDenied(\sprintf( 'Subscription to \'%s\' failed due to access denied', $this->streamId ))); @@ -173,7 +173,7 @@ public function inspectPackage(TcpPackage $package): InspectionResult $message->getReason() )); } - $this->dropSubscription(SubscriptionDropReason::unknown(), new UnexpectedCommandException( + $this->dropSubscription(SubscriptionDropReason::unknown(), new UnexpectedCommand( 'Unsubscribe reason: ' . $message->getReason() )); break; @@ -181,7 +181,7 @@ public function inspectPackage(TcpPackage $package): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'SubscriptionDropped: ' . $message->getReason()); case TcpCommand::NOT_AUTHENTICATED_EXCEPTION: - $this->dropSubscription(SubscriptionDropReason::notAuthenticated(), new NotAuthenticatedException()); + $this->dropSubscription(SubscriptionDropReason::notAuthenticated(), new NotAuthenticated()); return new InspectionResult(InspectionDecision::endOperation(), 'NotAuthenticated'); case TcpCommand::BAD_REQUEST: @@ -230,7 +230,7 @@ public function inspectPackage(TcpPackage $package): InspectionResult default: $this->dropSubscription( SubscriptionDropReason::serverError(), - UnexpectedCommandException::withName($package->command()->name()) + UnexpectedCommand::withName($package->command()->name()) ); return new InspectionResult(InspectionDecision::endOperation(), $package->command()->name()); @@ -247,7 +247,7 @@ public function connectionClosed(): void { $this->dropSubscription( SubscriptionDropReason::connectionClosed(), - new ConnectionClosedException('Connection was closed') + new ConnectionClosed('Connection was closed') ); } diff --git a/src/ClientOperations/AppendToStreamOperation.php b/src/ClientOperations/AppendToStreamOperation.php index aa1b761c..a5c8bd0a 100644 --- a/src/ClientOperations/AppendToStreamOperation.php +++ b/src/ClientOperations/AppendToStreamOperation.php @@ -15,11 +15,11 @@ use Amp\Deferred; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\AccessDeniedException; -use Prooph\EventStore\Exception\InvalidTransactionException; -use Prooph\EventStore\Exception\StreamDeletedException; +use Prooph\EventStore\Exception\AccessDenied; +use Prooph\EventStore\Exception\InvalidTransaction; +use Prooph\EventStore\Exception\StreamDeleted; use Prooph\EventStore\Exception\UnexpectedOperationResult; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\Position; use Prooph\EventStore\UserCredentials; use Prooph\EventStore\WriteResult; @@ -105,7 +105,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult case OperationResult::CommitTimeout: return new InspectionResult(InspectionDecision::retry(), 'CommitTimeout'); case OperationResult::WrongExpectedVersion: - $this->fail(WrongExpectedVersionException::with( + $this->fail(WrongExpectedVersion::with( $this->stream, $this->expectedVersion, $response->getCurrentVersion() @@ -113,17 +113,17 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'WrongExpectedVersion'); case OperationResult::StreamDeleted: - $exception = StreamDeletedException::with($this->stream); + $exception = StreamDeleted::with($this->stream); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'StreamDeleted'); case OperationResult::InvalidTransaction: - $exception = new InvalidTransactionException(); + $exception = new InvalidTransaction(); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'InvalidTransaction'); case OperationResult::AccessDenied: - $exception = AccessDeniedException::toStream($this->stream); + $exception = AccessDenied::toStream($this->stream); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); diff --git a/src/ClientOperations/CommitTransactionOperation.php b/src/ClientOperations/CommitTransactionOperation.php index 4e3c3dcc..f246bf44 100644 --- a/src/ClientOperations/CommitTransactionOperation.php +++ b/src/ClientOperations/CommitTransactionOperation.php @@ -14,11 +14,11 @@ namespace Prooph\EventStoreClient\ClientOperations; use Amp\Deferred; -use Prooph\EventStore\Exception\AccessDeniedException; -use Prooph\EventStore\Exception\InvalidTransactionException; -use Prooph\EventStore\Exception\StreamDeletedException; +use Prooph\EventStore\Exception\AccessDenied; +use Prooph\EventStore\Exception\InvalidTransaction; +use Prooph\EventStore\Exception\StreamDeleted; use Prooph\EventStore\Exception\UnexpectedOperationResult; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\Position; use Prooph\EventStore\UserCredentials; use Prooph\EventStore\WriteResult; @@ -84,22 +84,22 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult case OperationResult::CommitTimeout: return new InspectionResult(InspectionDecision::retry(), 'CommitTimeout'); case OperationResult::WrongExpectedVersion: - $this->fail(new WrongExpectedVersionException(\sprintf( + $this->fail(new WrongExpectedVersion(\sprintf( 'Commit transaction failed due to WrongExpectedVersion. Transaction id: \'%s\'', $this->transactionId ))); return new InspectionResult(InspectionDecision::endOperation(), 'WrongExpectedVersion'); case OperationResult::StreamDeleted: - $this->fail(new StreamDeletedException()); + $this->fail(new StreamDeleted()); return new InspectionResult(InspectionDecision::endOperation(), 'StreamDeleted'); case OperationResult::InvalidTransaction: - $this->fail(new InvalidTransactionException()); + $this->fail(new InvalidTransaction()); return new InspectionResult(InspectionDecision::endOperation(), 'InvalidTransaction'); case OperationResult::AccessDenied: - $exception = new AccessDeniedException('Write access denied'); + $exception = new AccessDenied('Write access denied'); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); diff --git a/src/ClientOperations/ConditionalAppendToStreamOperation.php b/src/ClientOperations/ConditionalAppendToStreamOperation.php index d356cab8..7d5b6c20 100644 --- a/src/ClientOperations/ConditionalAppendToStreamOperation.php +++ b/src/ClientOperations/ConditionalAppendToStreamOperation.php @@ -17,8 +17,8 @@ use Prooph\EventStore\ConditionalWriteResult; use Prooph\EventStore\ConditionalWriteStatus; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\AccessDeniedException; -use Prooph\EventStore\Exception\InvalidTransactionException; +use Prooph\EventStore\Exception\AccessDenied; +use Prooph\EventStore\Exception\InvalidTransaction; use Prooph\EventStore\Exception\UnexpectedOperationResult; use Prooph\EventStore\Position; use Prooph\EventStore\UserCredentials; @@ -106,12 +106,12 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'StreamDeleted'); case OperationResult::InvalidTransaction: - $exception = new InvalidTransactionException(); + $exception = new InvalidTransaction(); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'InvalidTransaction'); case OperationResult::AccessDenied: - $exception = AccessDeniedException::toStream($this->stream); + $exception = AccessDenied::toStream($this->stream); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); diff --git a/src/ClientOperations/ConnectToPersistentSubscriptionOperation.php b/src/ClientOperations/ConnectToPersistentSubscriptionOperation.php index 3d75f674..5c338052 100644 --- a/src/ClientOperations/ConnectToPersistentSubscriptionOperation.php +++ b/src/ClientOperations/ConnectToPersistentSubscriptionOperation.php @@ -16,10 +16,10 @@ use Amp\Deferred; use Prooph\EventStore\EventId; use Prooph\EventStore\EventStoreSubscription; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\MaximumSubscribersReachedException; -use Prooph\EventStore\Exception\PersistentSubscriptionDeletedException; +use Prooph\EventStore\Exception\MaximumSubscribersReached; +use Prooph\EventStore\Exception\PersistentSubscriptionDeleted; use Prooph\EventStore\Internal\ConnectToPersistentSubscriptions; use Prooph\EventStore\Internal\PersistentEventStoreSubscription; use Prooph\EventStore\PersistentSubscriptionNakEventAction; @@ -132,7 +132,7 @@ protected function preInspectPackage(TcpPackage $package): ?InspectionResult $message->parseFromString($package->data()); if ($message->getReason() === SubscriptionDropReasonMessage::AccessDenied) { - $this->dropSubscription(SubscriptionDropReason::accessDenied(), new AccessDeniedException('You do not have access to the stream')); + $this->dropSubscription(SubscriptionDropReason::accessDenied(), new AccessDenied('You do not have access to the stream')); return new InspectionResult(InspectionDecision::endOperation(), 'SubscriptionDropped'); } @@ -144,13 +144,13 @@ protected function preInspectPackage(TcpPackage $package): ?InspectionResult } if ($message->getReason() === SubscriptionDropReasonMessage::PersistentSubscriptionDeleted) { - $this->dropSubscription(SubscriptionDropReason::persistentSubscriptionDeleted(), new PersistentSubscriptionDeletedException()); + $this->dropSubscription(SubscriptionDropReason::persistentSubscriptionDeleted(), new PersistentSubscriptionDeleted()); return new InspectionResult(InspectionDecision::endOperation(), 'SubscriptionDropped'); } if ($message->getReason() === SubscriptionDropReasonMessage::SubscriberMaxCountReached) { - $this->dropSubscription(SubscriptionDropReason::maxSubscribersReached(), new MaximumSubscribersReachedException()); + $this->dropSubscription(SubscriptionDropReason::maxSubscribersReached(), new MaximumSubscribersReached()); return new InspectionResult(InspectionDecision::endOperation(), 'SubscriptionDropped'); } diff --git a/src/ClientOperations/CreatePersistentSubscriptionOperation.php b/src/ClientOperations/CreatePersistentSubscriptionOperation.php index 2a25bc18..87b3797d 100644 --- a/src/ClientOperations/CreatePersistentSubscriptionOperation.php +++ b/src/ClientOperations/CreatePersistentSubscriptionOperation.php @@ -15,7 +15,7 @@ use Amp\Deferred; use Prooph\EventStore\Common\SystemConsumerStrategies; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\InvalidOperationException; use Prooph\EventStore\Exception\UnexpectedOperationResult; use Prooph\EventStore\Internal\PersistentSubscriptionCreateResult; @@ -105,7 +105,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Fail'); case CreatePersistentSubscriptionResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); case CreatePersistentSubscriptionResult::AlreadyExists: diff --git a/src/ClientOperations/DeletePersistentSubscriptionOperation.php b/src/ClientOperations/DeletePersistentSubscriptionOperation.php index 01a88dd7..2b76829f 100644 --- a/src/ClientOperations/DeletePersistentSubscriptionOperation.php +++ b/src/ClientOperations/DeletePersistentSubscriptionOperation.php @@ -14,7 +14,7 @@ namespace Prooph\EventStoreClient\ClientOperations; use Amp\Deferred; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\InvalidOperationException; use Prooph\EventStore\Exception\UnexpectedOperationResult; use Prooph\EventStore\Internal\PersistentSubscriptionDeleteResult; @@ -85,7 +85,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Fail'); case DeletePersistentSubscriptionResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); case DeletePersistentSubscriptionResult::DoesNotExist: diff --git a/src/ClientOperations/DeleteStreamOperation.php b/src/ClientOperations/DeleteStreamOperation.php index a052a854..5f2b32a3 100644 --- a/src/ClientOperations/DeleteStreamOperation.php +++ b/src/ClientOperations/DeleteStreamOperation.php @@ -15,11 +15,11 @@ use Amp\Deferred; use Prooph\EventStore\DeleteResult; -use Prooph\EventStore\Exception\AccessDeniedException; -use Prooph\EventStore\Exception\InvalidTransactionException; -use Prooph\EventStore\Exception\StreamDeletedException; +use Prooph\EventStore\Exception\AccessDenied; +use Prooph\EventStore\Exception\InvalidTransaction; +use Prooph\EventStore\Exception\StreamDeleted; use Prooph\EventStore\Exception\UnexpectedOperationResult; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\Position; use Prooph\EventStore\UserCredentials; use Prooph\EventStoreClient\Messages\ClientMessages\DeleteStream; @@ -94,24 +94,24 @@ public function inspectResponse(ProtobufMessage $response): InspectionResult case OperationResult::ForwardTimeout: return new InspectionResult(InspectionDecision::retry(), 'ForwardTimeout'); case OperationResult::WrongExpectedVersion: - $this->fail(WrongExpectedVersionException::with( + $this->fail(WrongExpectedVersion::with( $this->stream, $this->expectedVersion )); return new InspectionResult(InspectionDecision::endOperation(), 'WrongExpectedVersion'); case OperationResult::StreamDeleted: - $exception = StreamDeletedException::with($this->stream); + $exception = StreamDeleted::with($this->stream); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'StreamDeleted'); case OperationResult::InvalidTransaction: - $exception = new InvalidTransactionException(); + $exception = new InvalidTransaction(); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'InvalidTransaction'); case OperationResult::AccessDenied: - $exception = AccessDeniedException::toStream($this->stream); + $exception = AccessDenied::toStream($this->stream); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); diff --git a/src/ClientOperations/ReadAllEventsBackwardOperation.php b/src/ClientOperations/ReadAllEventsBackwardOperation.php index 8f3a9ff8..d740ac4f 100644 --- a/src/ClientOperations/ReadAllEventsBackwardOperation.php +++ b/src/ClientOperations/ReadAllEventsBackwardOperation.php @@ -15,7 +15,7 @@ use Amp\Deferred; use Prooph\EventStore\AllEventsSlice; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\ServerError; use Prooph\EventStore\Position; use Prooph\EventStore\ReadDirection; @@ -94,7 +94,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Error'); case ReadAllResult::AccessDenied: - $this->fail(AccessDeniedException::toAllStream()); + $this->fail(AccessDenied::toAllStream()); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); default: diff --git a/src/ClientOperations/ReadAllEventsForwardOperation.php b/src/ClientOperations/ReadAllEventsForwardOperation.php index 2f669137..b9f728ef 100644 --- a/src/ClientOperations/ReadAllEventsForwardOperation.php +++ b/src/ClientOperations/ReadAllEventsForwardOperation.php @@ -15,7 +15,7 @@ use Amp\Deferred; use Prooph\EventStore\AllEventsSlice; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\ServerError; use Prooph\EventStore\Position; use Prooph\EventStore\ReadDirection; @@ -94,7 +94,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Error'); case ReadAllResult::AccessDenied: - $this->fail(AccessDeniedException::toAllStream()); + $this->fail(AccessDenied::toAllStream()); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); default: diff --git a/src/ClientOperations/ReadEventOperation.php b/src/ClientOperations/ReadEventOperation.php index 3318814e..224d813a 100644 --- a/src/ClientOperations/ReadEventOperation.php +++ b/src/ClientOperations/ReadEventOperation.php @@ -16,7 +16,7 @@ use Amp\Deferred; use Prooph\EventStore\EventReadResult; use Prooph\EventStore\EventReadStatus; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\ServerError; use Prooph\EventStore\ResolvedEvent; use Prooph\EventStore\UserCredentials; @@ -103,7 +103,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Error'); case ReadEventResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); default: diff --git a/src/ClientOperations/ReadStreamEventsBackwardOperation.php b/src/ClientOperations/ReadStreamEventsBackwardOperation.php index a2a0a1e4..c6dd856b 100644 --- a/src/ClientOperations/ReadStreamEventsBackwardOperation.php +++ b/src/ClientOperations/ReadStreamEventsBackwardOperation.php @@ -14,7 +14,7 @@ namespace Prooph\EventStoreClient\ClientOperations; use Amp\Deferred; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\ServerError; use Prooph\EventStore\ReadDirection; use Prooph\EventStore\ResolvedEvent; @@ -106,7 +106,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Error'); case ReadStreamResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); default: diff --git a/src/ClientOperations/ReadStreamEventsForwardOperation.php b/src/ClientOperations/ReadStreamEventsForwardOperation.php index f4eaf942..f0c37932 100644 --- a/src/ClientOperations/ReadStreamEventsForwardOperation.php +++ b/src/ClientOperations/ReadStreamEventsForwardOperation.php @@ -14,7 +14,7 @@ namespace Prooph\EventStoreClient\ClientOperations; use Amp\Deferred; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\ServerError; use Prooph\EventStore\ReadDirection; use Prooph\EventStore\ResolvedEvent; @@ -106,7 +106,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Error'); case ReadStreamResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); default: diff --git a/src/ClientOperations/StartTransactionOperation.php b/src/ClientOperations/StartTransactionOperation.php index 8d3fd1d8..390c996c 100644 --- a/src/ClientOperations/StartTransactionOperation.php +++ b/src/ClientOperations/StartTransactionOperation.php @@ -15,11 +15,11 @@ use Amp\Deferred; use Prooph\EventStore\AsyncEventStoreTransaction; -use Prooph\EventStore\Exception\AccessDeniedException; -use Prooph\EventStore\Exception\InvalidTransactionException; -use Prooph\EventStore\Exception\StreamDeletedException; +use Prooph\EventStore\Exception\AccessDenied; +use Prooph\EventStore\Exception\InvalidTransaction; +use Prooph\EventStore\Exception\StreamDeleted; use Prooph\EventStore\Exception\UnexpectedOperationResult; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\Internal\AsyncEventStoreTransactionConnection; use Prooph\EventStore\UserCredentials; use Prooph\EventStoreClient\Messages\ClientMessages\OperationResult; @@ -93,22 +93,22 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult case OperationResult::ForwardTimeout: return new InspectionResult(InspectionDecision::retry(), 'ForwardTimeout'); case OperationResult::WrongExpectedVersion: - $this->fail(WrongExpectedVersionException::with( + $this->fail(WrongExpectedVersion::with( $this->stream, $this->expectedVersion )); return new InspectionResult(InspectionDecision::endOperation(), 'WrongExpectedVersion'); case OperationResult::StreamDeleted: - $this->fail(StreamDeletedException::with($this->stream)); + $this->fail(StreamDeleted::with($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'StreamDeleted'); case OperationResult::InvalidTransaction: - $this->fail(new InvalidTransactionException()); + $this->fail(new InvalidTransaction()); return new InspectionResult(InspectionDecision::endOperation(), 'InvalidTransaction'); case OperationResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); default: diff --git a/src/ClientOperations/TransactionalWriteOperation.php b/src/ClientOperations/TransactionalWriteOperation.php index 3100f7b3..f2604484 100644 --- a/src/ClientOperations/TransactionalWriteOperation.php +++ b/src/ClientOperations/TransactionalWriteOperation.php @@ -15,7 +15,7 @@ use Amp\Deferred; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\UnexpectedOperationResult; use Prooph\EventStore\UserCredentials; use Prooph\EventStoreClient\Internal\NewEventConverter; @@ -89,7 +89,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult case OperationResult::CommitTimeout: return new InspectionResult(InspectionDecision::retry(), 'CommitTimeout'); case OperationResult::AccessDenied: - $exception = new AccessDeniedException('Write access denied'); + $exception = new AccessDenied('Write access denied'); $this->fail($exception); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); diff --git a/src/ClientOperations/UpdatePersistentSubscriptionOperation.php b/src/ClientOperations/UpdatePersistentSubscriptionOperation.php index 5170b351..032a6bb6 100644 --- a/src/ClientOperations/UpdatePersistentSubscriptionOperation.php +++ b/src/ClientOperations/UpdatePersistentSubscriptionOperation.php @@ -15,7 +15,7 @@ use Amp\Deferred; use Prooph\EventStore\Common\SystemConsumerStrategies; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Exception\InvalidOperationException; use Prooph\EventStore\Exception\UnexpectedOperationResult; use Prooph\EventStore\Internal\PersistentSubscriptionUpdateResult; @@ -105,7 +105,7 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult return new InspectionResult(InspectionDecision::endOperation(), 'Fail'); case UpdatePersistentSubscriptionResult::AccessDenied: - $this->fail(AccessDeniedException::toStream($this->stream)); + $this->fail(AccessDenied::toStream($this->stream)); return new InspectionResult(InspectionDecision::endOperation(), 'AccessDenied'); case UpdatePersistentSubscriptionResult::DoesNotExist: diff --git a/src/Exception/PersistentSubscriptionCommandFailedException.php b/src/Exception/PersistentSubscriptionCommandFailed.php similarity index 88% rename from src/Exception/PersistentSubscriptionCommandFailedException.php rename to src/Exception/PersistentSubscriptionCommandFailed.php index 93e4f1fc..f9876248 100644 --- a/src/Exception/PersistentSubscriptionCommandFailedException.php +++ b/src/Exception/PersistentSubscriptionCommandFailed.php @@ -13,9 +13,9 @@ namespace Prooph\EventStoreClient\Exception; -use Prooph\EventStore\Exception\PersistentSubscriptionCommandFailedException as BaseException; +use Prooph\EventStore\Exception\PersistentSubscriptionCommandFailed as BaseException; -class PersistentSubscriptionCommandFailedException extends BaseException +class PersistentSubscriptionCommandFailed extends BaseException { /** @var int */ private $httpStatusCode; diff --git a/src/Exception/UserCommandFailedException.php b/src/Exception/ProjectionCommandConflict.php similarity index 84% rename from src/Exception/UserCommandFailedException.php rename to src/Exception/ProjectionCommandConflict.php index 9c312b9e..3ef27777 100644 --- a/src/Exception/UserCommandFailedException.php +++ b/src/Exception/ProjectionCommandConflict.php @@ -13,9 +13,9 @@ namespace Prooph\EventStoreClient\Exception; -use Prooph\EventStore\Exception\UserCommandFailedException as BaseException; +use Prooph\EventStore\Exception\ProjectionCommandConflict as BaseException; -class UserCommandFailedException extends BaseException +class ProjectionCommandConflict extends BaseException { /** @var int */ private $httpStatusCode; diff --git a/src/Exception/UserCommandConflictException.php b/src/Exception/ProjectionCommandFailed.php similarity index 84% rename from src/Exception/UserCommandConflictException.php rename to src/Exception/ProjectionCommandFailed.php index 82c568ff..a75628c5 100644 --- a/src/Exception/UserCommandConflictException.php +++ b/src/Exception/ProjectionCommandFailed.php @@ -13,9 +13,9 @@ namespace Prooph\EventStoreClient\Exception; -use Prooph\EventStore\Exception\UserCommandConflictException as BaseException; +use Prooph\EventStore\Exception\ProjectionCommandFailed as BaseException; -class UserCommandConflictException extends BaseException +class ProjectionCommandFailed extends BaseException { /** @var int */ private $httpStatusCode; diff --git a/src/Exception/ProjectionCommandFailedException.php b/src/Exception/UserCommandConflict.php similarity index 83% rename from src/Exception/ProjectionCommandFailedException.php rename to src/Exception/UserCommandConflict.php index 6ce44b2a..5196230b 100644 --- a/src/Exception/ProjectionCommandFailedException.php +++ b/src/Exception/UserCommandConflict.php @@ -13,9 +13,9 @@ namespace Prooph\EventStoreClient\Exception; -use Prooph\EventStore\Exception\ProjectionCommandFailedException as BaseException; +use Prooph\EventStore\Exception\UserCommandConflict as BaseException; -class ProjectionCommandFailedException extends BaseException +class UserCommandConflict extends BaseException { /** @var int */ private $httpStatusCode; diff --git a/src/Exception/ProjectionCommandConflictException.php b/src/Exception/UserCommandFailed.php similarity index 82% rename from src/Exception/ProjectionCommandConflictException.php rename to src/Exception/UserCommandFailed.php index 660bce81..18d2423f 100644 --- a/src/Exception/ProjectionCommandConflictException.php +++ b/src/Exception/UserCommandFailed.php @@ -13,9 +13,9 @@ namespace Prooph\EventStoreClient\Exception; -use Prooph\EventStore\Exception\ProjectionCommandConflictException as BaseException; +use Prooph\EventStore\Exception\UserCommandFailed as BaseException; -class ProjectionCommandConflictException extends BaseException +class UserCommandFailed extends BaseException { /** @var int */ private $httpStatusCode; diff --git a/src/Internal/EventStoreConnectionLogicHandler.php b/src/Internal/EventStoreConnectionLogicHandler.php index 8395c071..a52bb6f2 100644 --- a/src/Internal/EventStoreConnectionLogicHandler.php +++ b/src/Internal/EventStoreConnectionLogicHandler.php @@ -24,10 +24,10 @@ use Prooph\EventStore\ClientErrorEventArgs; use Prooph\EventStore\ClientReconnectingEventArgs; use Prooph\EventStore\EndPoint; -use Prooph\EventStore\Exception\CannotEstablishConnectionException; +use Prooph\EventStore\Exception\CannotEstablishConnection; use Prooph\EventStore\Exception\EventStoreConnectionException; use Prooph\EventStore\Exception\InvalidOperationException; -use Prooph\EventStore\Exception\ObjectDisposedException; +use Prooph\EventStore\Exception\ObjectDisposed; use Prooph\EventStore\Internal\Consts; use Prooph\EventStore\Internal\EventHandler; use Prooph\EventStore\ListenerHandler; @@ -212,7 +212,7 @@ private function startConnection(Deferred $deferred, EndPointDiscoverer $endPoin ))); break; case ConnectionState::CLOSED: - $deferred->fail(new ObjectDisposedException($this->esConnection->connectionName())); + $deferred->fail(new ObjectDisposed($this->esConnection->connectionName())); break; } } @@ -245,7 +245,7 @@ private function discoverEndPoint(?Deferred $deferred): void )); if ($deferred) { - $deferred->fail(new CannotEstablishConnectionException('Cannot resolve target end point')); + $deferred->fail(new CannotEstablishConnection('Cannot resolve target end point')); } return; @@ -634,7 +634,7 @@ private function startOperation(ClientOperation $operation, int $maxRetries, int $this->operations->scheduleOperation(new OperationItem($operation, $maxRetries, $timeout), $this->connection); break; case ConnectionState::CLOSED: - $operation->fail(new ObjectDisposedException($this->esConnection->connectionName())); + $operation->fail(new ObjectDisposed($this->esConnection->connectionName())); break; } } @@ -683,7 +683,7 @@ function (): ?TcpPackageConnection { break; case ConnectionState::CLOSED: - $message->deferred()->fail(new ObjectDisposedException($this->esConnection->connectionName())); + $message->deferred()->fail(new ObjectDisposed($this->esConnection->connectionName())); break; } } @@ -733,7 +733,7 @@ function (): ?TcpPackageConnection { break; case ConnectionState::CLOSED: - $message->deferred()->fail(new ObjectDisposedException($this->esConnection->connectionName())); + $message->deferred()->fail(new ObjectDisposed($this->esConnection->connectionName())); break; } } diff --git a/src/Internal/EventStoreNodeConnection.php b/src/Internal/EventStoreNodeConnection.php index 1adbac2b..a7ece9d0 100644 --- a/src/Internal/EventStoreNodeConnection.php +++ b/src/Internal/EventStoreNodeConnection.php @@ -30,7 +30,7 @@ use Prooph\EventStore\EventReadStatus; use Prooph\EventStore\Exception\InvalidArgumentException; use Prooph\EventStore\Exception\InvalidOperationException; -use Prooph\EventStore\Exception\MaxQueueSizeLimitReachedException; +use Prooph\EventStore\Exception\MaxQueueSizeLimitReached; use Prooph\EventStore\Exception\OutOfRangeException; use Prooph\EventStore\Exception\UnexpectedValueException; use Prooph\EventStore\ExpectedVersion; @@ -895,7 +895,7 @@ public function detach(ListenerHandler $handler): void private function enqueueOperation(ClientOperation $operation): void { if ($this->handler->totalOperationCount() >= $this->settings->maxQueueSize()) { - throw MaxQueueSizeLimitReachedException::with($this->connectionName, $this->settings->maxQueueSize()); + throw MaxQueueSizeLimitReached::with($this->connectionName, $this->settings->maxQueueSize()); } $this->handler->enqueueMessage(new StartOperationMessage( diff --git a/src/Internal/EventStoreStreamCatchUpSubscription.php b/src/Internal/EventStoreStreamCatchUpSubscription.php index 330258a5..e621dfc3 100644 --- a/src/Internal/EventStoreStreamCatchUpSubscription.php +++ b/src/Internal/EventStoreStreamCatchUpSubscription.php @@ -22,7 +22,7 @@ use Prooph\EventStore\CatchUpSubscriptionSettings; use Prooph\EventStore\EventAppearedOnAsyncCatchupSubscription; use Prooph\EventStore\Exception\OutOfRangeException; -use Prooph\EventStore\Exception\StreamDeletedException; +use Prooph\EventStore\Exception\StreamDeleted; use Prooph\EventStore\LiveProcessingStartedOnAsyncCatchUpSubscription; use Prooph\EventStore\ResolvedEvent; use Prooph\EventStore\SliceReadStatus; @@ -154,7 +154,7 @@ private function processEventsAsync(?int $lastEventNumber, StreamEventsSlice $sl break; case SliceReadStatus::STREAM_DELETED: - throw StreamDeletedException::with($this->streamId()); + throw StreamDeleted::with($this->streamId()); default: throw new OutOfRangeException(\sprintf( 'Unexpected SliceReadStatus "%s" received', diff --git a/src/Internal/OperationsManager.php b/src/Internal/OperationsManager.php index 1ea4514b..e6b0f29e 100644 --- a/src/Internal/OperationsManager.php +++ b/src/Internal/OperationsManager.php @@ -14,9 +14,9 @@ namespace Prooph\EventStoreClient\Internal; use Amp\Promise; -use Prooph\EventStore\Exception\ConnectionClosedException; -use Prooph\EventStore\Exception\OperationTimedOutException; -use Prooph\EventStore\Exception\RetriesLimitReachedException; +use Prooph\EventStore\Exception\ConnectionClosed; +use Prooph\EventStore\Exception\OperationTimedOut; +use Prooph\EventStore\Exception\RetriesLimitReached; use Prooph\EventStore\Util\DateTime; use Prooph\EventStore\Util\Guid; use Prooph\EventStoreClient\ConnectionSettings; @@ -69,7 +69,7 @@ public function getActiveOperation(string $correlationId): ?OperationItem public function cleanUp(): void { - $closedConnectionException = ConnectionClosedException::withName($this->connectionName); + $closedConnectionException = ConnectionClosed::withName($this->connectionName); foreach ($this->activeOperations as $operationItem) { try { @@ -120,7 +120,7 @@ public function checkTimeoutsAndRetry(TcpPackageConnection $connection): void $this->settings->log()->error($err); if ($this->settings->failOnNoServerResponse()) { - $operation->operation()->fail(new OperationTimedOutException($err)); + $operation->operation()->fail(new OperationTimedOut($err)); $removeOperations[] = $operation; } else { $retryOperations[] = $operation; @@ -162,7 +162,7 @@ public function scheduleOperationRetry(OperationItem $operation): void $this->logDebug('ScheduleOperationRetry for %s', $operation); if ($operation->maxRetries() >= 0 && $operation->retryCount() >= $operation->maxRetries()) { $operation->operation()->fail( - RetriesLimitReachedException::with($operation->retryCount()) + RetriesLimitReached::with($operation->retryCount()) ); return; diff --git a/src/Internal/SubscriptionsManager.php b/src/Internal/SubscriptionsManager.php index dcb3ba30..10eacb83 100644 --- a/src/Internal/SubscriptionsManager.php +++ b/src/Internal/SubscriptionsManager.php @@ -13,9 +13,9 @@ namespace Prooph\EventStoreClient\Internal; -use Prooph\EventStore\Exception\ConnectionClosedException; -use Prooph\EventStore\Exception\OperationTimedOutException; -use Prooph\EventStore\Exception\RetriesLimitReachedException; +use Prooph\EventStore\Exception\ConnectionClosed; +use Prooph\EventStore\Exception\OperationTimedOut; +use Prooph\EventStore\Exception\RetriesLimitReached; use Prooph\EventStore\SubscriptionDropReason; use Prooph\EventStore\Util\DateTime; use Prooph\EventStore\Util\Guid; @@ -51,7 +51,7 @@ public function getActiveSubscription(string $correlationId): ?SubscriptionItem public function cleanUp(): void { - $connectionClosedException = ConnectionClosedException::withName($this->connectionName); + $connectionClosedException = ConnectionClosed::withName($this->connectionName); foreach ($this->activeSubscriptions as $subscriptionItem) { $subscriptionItem->operation()->dropSubscription( @@ -125,7 +125,7 @@ public function checkTimeoutsAndRetry(TcpPackageConnection $connection): void if ($this->settings->failOnNoServerResponse()) { $subscription->operation()->dropSubscription( SubscriptionDropReason::subscribingError(), - new OperationTimedOutException($err) + new OperationTimedOut($err) ); $removeSubscriptions->enqueue($subscription); } else { @@ -177,7 +177,7 @@ public function scheduleSubscriptionRetry(SubscriptionItem $subscription): void $this->logDebug('RETRIES LIMIT REACHED when trying to retry %s', $subscription); $subscription->operation()->dropSubscription( SubscriptionDropReason::subscribingError(), - RetriesLimitReachedException::with($subscription->retryCount()) + RetriesLimitReached::with($subscription->retryCount()) ); return; diff --git a/src/PersistentSubscriptions/PersistentSubscriptionsClient.php b/src/PersistentSubscriptions/PersistentSubscriptionsClient.php index 3d915b8f..a455565b 100644 --- a/src/PersistentSubscriptions/PersistentSubscriptionsClient.php +++ b/src/PersistentSubscriptions/PersistentSubscriptionsClient.php @@ -23,7 +23,7 @@ use Prooph\EventStore\Transport\Http\HttpStatusCode; use Prooph\EventStore\UserCredentials; use Prooph\EventStore\Util\Json; -use Prooph\EventStoreClient\Exception\PersistentSubscriptionCommandFailedException; +use Prooph\EventStoreClient\Exception\PersistentSubscriptionCommandFailed; use Prooph\EventStoreClient\Transport\Http\HttpClient; use Throwable; @@ -187,7 +187,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve($response->getBody()); } else { - $deferred->fail(new PersistentSubscriptionCommandFailedException( + $deferred->fail(new PersistentSubscriptionCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for GET on %s', @@ -223,7 +223,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve(null); } else { - $deferred->fail(new PersistentSubscriptionCommandFailedException( + $deferred->fail(new PersistentSubscriptionCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for POST on %s', diff --git a/src/Projections/ProjectionsClient.php b/src/Projections/ProjectionsClient.php index b2c57988..c3cf9541 100644 --- a/src/Projections/ProjectionsClient.php +++ b/src/Projections/ProjectionsClient.php @@ -23,8 +23,8 @@ use Prooph\EventStore\Transport\Http\HttpStatusCode; use Prooph\EventStore\UserCredentials; use Prooph\EventStore\Util\Json; -use Prooph\EventStoreClient\Exception\ProjectionCommandConflictException; -use Prooph\EventStoreClient\Exception\ProjectionCommandFailedException; +use Prooph\EventStoreClient\Exception\ProjectionCommandConflict; +use Prooph\EventStoreClient\Exception\ProjectionCommandFailed; use Prooph\EventStoreClient\Transport\Http\HttpClient; use Throwable; @@ -537,7 +537,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve($response->getBody()); } else { - $deferred->fail(new ProjectionCommandFailedException( + $deferred->fail(new ProjectionCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for GET on %s', @@ -570,7 +570,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve($response->getBody()); } else { - $deferred->fail(new ProjectionCommandFailedException( + $deferred->fail(new ProjectionCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for DELETE on %s', @@ -606,7 +606,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve(null); } else { - $deferred->fail(new ProjectionCommandFailedException( + $deferred->fail(new ProjectionCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for PUT on %s', @@ -642,9 +642,9 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve(null); } elseif ($response->getStatus() === HttpStatusCode::CONFLICT) { - $deferred->fail(new ProjectionCommandConflictException($response->getStatus(), $response->getReason())); + $deferred->fail(new ProjectionCommandConflict($response->getStatus(), $response->getReason())); } else { - $deferred->fail(new ProjectionCommandFailedException( + $deferred->fail(new ProjectionCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for POST on %s', diff --git a/src/UserManagement/UsersClient.php b/src/UserManagement/UsersClient.php index f18bbcf3..ceeccb0d 100644 --- a/src/UserManagement/UsersClient.php +++ b/src/UserManagement/UsersClient.php @@ -27,8 +27,8 @@ use Prooph\EventStore\UserManagement\UserDetails; use Prooph\EventStore\UserManagement\UserUpdateInformation; use Prooph\EventStore\Util\Json; -use Prooph\EventStoreClient\Exception\UserCommandConflictException; -use Prooph\EventStoreClient\Exception\UserCommandFailedException; +use Prooph\EventStoreClient\Exception\UserCommandConflict; +use Prooph\EventStoreClient\Exception\UserCommandFailed; use Prooph\EventStoreClient\Transport\Http\HttpClient; use Throwable; @@ -315,7 +315,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve($response->getBody()); } else { - $deferred->fail(new UserCommandFailedException( + $deferred->fail(new UserCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for GET on %s', @@ -348,7 +348,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve($response->getBody()); } else { - $deferred->fail(new UserCommandFailedException( + $deferred->fail(new UserCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for DELETE on %s', @@ -384,7 +384,7 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve(null); } else { - $deferred->fail(new UserCommandFailedException( + $deferred->fail(new UserCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for PUT on %s', @@ -420,9 +420,9 @@ function (Response $response) use ($deferred, $expectedCode, $url): void { if ($response->getStatus() === $expectedCode) { $deferred->resolve(null); } elseif ($response->getStatus() === HttpStatusCode::CONFLICT) { - $deferred->fail(new UserCommandConflictException($response->getStatus(), $response->getReason())); + $deferred->fail(new UserCommandConflict($response->getStatus(), $response->getReason())); } else { - $deferred->fail(new UserCommandFailedException( + $deferred->fail(new UserCommandFailed( $response->getStatus(), \sprintf( 'Server returned %d (%s) for POST on %s', diff --git a/src/UserManagement/UsersManager.php b/src/UserManagement/UsersManager.php index a07c8969..b32eda85 100644 --- a/src/UserManagement/UsersManager.php +++ b/src/UserManagement/UsersManager.php @@ -24,7 +24,7 @@ use Prooph\EventStore\UserManagement\UserCreationInformation; use Prooph\EventStore\UserManagement\UserDetails; use Prooph\EventStore\UserManagement\UserUpdateInformation; -use Prooph\EventStoreClient\Exception\UserCommandFailedException; +use Prooph\EventStoreClient\Exception\UserCommandFailed; class UsersManager implements AsyncUsersManager { @@ -77,7 +77,7 @@ public function disableAsync(string $login, ?UserCredentials $userCredentials = ); } - /** @throws UserCommandFailedException */ + /** @throws UserCommandFailed */ public function deleteUserAsync(string $login, ?UserCredentials $userCredentials = null): Promise { if (empty($login)) { diff --git a/tests/UserManagement/change_password.php b/tests/UserManagement/change_password.php index 86a63518..7e964f9f 100644 --- a/tests/UserManagement/change_password.php +++ b/tests/UserManagement/change_password.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient\UserManagement; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\UserCommandFailedException; +use Prooph\EventStore\Exception\UserCommandFailed; use Prooph\EventStore\Transport\Http\HttpStatusCode; use Prooph\EventStore\UserCredentials; use ProophTest\EventStoreClient\DefaultData; @@ -75,7 +75,7 @@ public function can_change_password(): void new UserCredentials($this->username, 'password') ); - $this->expectException(UserCommandFailedException::class); + $this->expectException(UserCommandFailed::class); try { yield $this->manager->changePasswordAsync( @@ -84,7 +84,7 @@ public function can_change_password(): void 'foobar', new UserCredentials($this->username, 'password') ); - } catch (UserCommandFailedException $e) { + } catch (UserCommandFailed $e) { $this->assertSame(HttpStatusCode::UNAUTHORIZED, $e->httpStatusCode()); throw $e; diff --git a/tests/UserManagement/deleting_a_user.php b/tests/UserManagement/deleting_a_user.php index b5f8528a..f2bfc391 100644 --- a/tests/UserManagement/deleting_a_user.php +++ b/tests/UserManagement/deleting_a_user.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient\UserManagement; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\UserCommandFailedException; +use Prooph\EventStore\Exception\UserCommandFailed; use Prooph\EventStore\Transport\Http\HttpStatusCode; use Prooph\EventStore\UserManagement\UserDetails; use Prooph\EventStore\Util\Guid; @@ -30,11 +30,11 @@ class deleting_a_user extends TestWithNode public function deleting_non_existing_user_throws(): void { $this->execute(function () { - $this->expectException(UserCommandFailedException::class); + $this->expectException(UserCommandFailed::class); try { yield $this->manager->deleteUserAsync(Guid::generateString(), DefaultData::adminCredentials()); - } catch (UserCommandFailedException $e) { + } catch (UserCommandFailed $e) { $this->assertSame(HttpStatusCode::NOT_FOUND, $e->httpStatusCode()); throw $e; @@ -93,7 +93,7 @@ public function can_delete_a_user(): void yield $this->manager->deleteUserAsync($name, DefaultData::adminCredentials()); - $this->expectException(UserCommandFailedException::class); + $this->expectException(UserCommandFailed::class); yield $this->manager->getUserAsync($name, DefaultData::adminCredentials()); }); diff --git a/tests/UserManagement/enable_disable_user.php b/tests/UserManagement/enable_disable_user.php index ecc0b5ff..6ed0fe13 100644 --- a/tests/UserManagement/enable_disable_user.php +++ b/tests/UserManagement/enable_disable_user.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient\UserManagement; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\UserCommandFailedException; +use Prooph\EventStore\Exception\UserCommandFailed; use Prooph\EventStore\UserCredentials; use ProophTest\EventStoreClient\DefaultData; use Throwable; @@ -60,11 +60,11 @@ public function can_enable_disable_user(): void try { yield $this->manager->disableAsync('foo', DefaultData::adminCredentials()); - } catch (UserCommandFailedException $e) { + } catch (UserCommandFailed $e) { $thrown = true; } - $this->assertTrue($thrown, UserCommandFailedException::class . ' was expected'); + $this->assertTrue($thrown, UserCommandFailed::class . ' was expected'); yield $this->manager->enableAsync($this->username, DefaultData::adminCredentials()); diff --git a/tests/UserManagement/reset_password.php b/tests/UserManagement/reset_password.php index 02cc310c..6505d353 100644 --- a/tests/UserManagement/reset_password.php +++ b/tests/UserManagement/reset_password.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient\UserManagement; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\UserCommandFailedException; +use Prooph\EventStore\Exception\UserCommandFailed; use Prooph\EventStore\Transport\Http\HttpStatusCode; use Prooph\EventStore\UserCredentials; use ProophTest\EventStoreClient\DefaultData; @@ -61,7 +61,7 @@ public function can_reset_password(): void DefaultData::adminCredentials() ); - $this->expectException(UserCommandFailedException::class); + $this->expectException(UserCommandFailed::class); try { yield $this->manager->changePasswordAsync( @@ -70,7 +70,7 @@ public function can_reset_password(): void 'foobar', new UserCredentials($this->username, 'password') ); - } catch (UserCommandFailedException $e) { + } catch (UserCommandFailed $e) { $this->assertSame(HttpStatusCode::UNAUTHORIZED, $e->httpStatusCode()); throw $e; diff --git a/tests/UserManagement/updating_a_user.php b/tests/UserManagement/updating_a_user.php index 8dcde812..07d60f0f 100644 --- a/tests/UserManagement/updating_a_user.php +++ b/tests/UserManagement/updating_a_user.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient\UserManagement; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\UserCommandFailedException; +use Prooph\EventStore\Exception\UserCommandFailed; use Prooph\EventStore\UserManagement\UserDetails; use Prooph\EventStore\Util\Guid; use ProophTest\EventStoreClient\DefaultData; @@ -55,7 +55,7 @@ public function updating_a_user_with_empty_name_throws(): void public function updating_non_existing_user_throws(): void { $this->execute(function () { - $this->expectException(UserCommandFailedException::class); + $this->expectException(UserCommandFailed::class); yield $this->manager->updateUserAsync(Guid::generateString(), 'bar', ['foo'], DefaultData::adminCredentials()); }); diff --git a/tests/append_to_stream.php b/tests/append_to_stream.php index 12b7a8df..431497e7 100644 --- a/tests/append_to_stream.php +++ b/tests/append_to_stream.php @@ -20,8 +20,8 @@ use Prooph\EventStore\ConditionalWriteResult; use Prooph\EventStore\ConditionalWriteStatus; use Prooph\EventStore\Exception\InvalidArgumentException; -use Prooph\EventStore\Exception\StreamDeletedException; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\StreamDeleted; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\ReadDirection; use Prooph\EventStore\StreamEventsSlice; @@ -275,7 +275,7 @@ public function should_fail_writing_with_correct_exp_ver_to_deleted_stream(): vo yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); try { - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); } finally { $connection->close(); @@ -325,7 +325,7 @@ public function should_fail_writing_with_any_exp_ver_to_deleted_stream(): void } try { - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $connection->appendToStreamAsync($stream, ExpectedVersion::ANY, [TestEvent::newTestEvent()]); } finally { $connection->close(); @@ -348,7 +348,7 @@ public function should_fail_writing_with_invalid_exp_ver_to_deleted_stream(): vo yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); try { yield $connection->appendToStreamAsync($stream, 5, [TestEvent::newTestEvent()]); } finally { @@ -415,7 +415,7 @@ public function should_fail_appending_with_wrong_exp_ver_to_existing_stream(): v yield $connection->connectAsync(); try { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $connection->appendToStreamAsync($stream, 1, [TestEvent::newTestEvent()]); } finally { $connection->close(); @@ -510,7 +510,7 @@ public function should_fail_appending_with_stream_exists_exp_ver_and_stream_does yield $connection->connectAsync(); try { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $connection->appendToStreamAsync($stream, ExpectedVersion::STREAM_EXISTS, [TestEvent::newTestEvent()]); } finally { $connection->close(); @@ -534,7 +534,7 @@ public function should_fail_appending_with_stream_exists_exp_ver_to_hard_deleted yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); try { - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $connection->appendToStreamAsync($stream, ExpectedVersion::STREAM_EXISTS, [TestEvent::newTestEvent()]); } finally { $connection->close(); @@ -558,7 +558,7 @@ public function should_fail_appending_with_stream_exists_exp_ver_to_soft_deleted yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, false); try { - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $connection->appendToStreamAsync($stream, ExpectedVersion::STREAM_EXISTS, [TestEvent::newTestEvent()]); } finally { $connection->close(); diff --git a/tests/appending_to_implicitly_created_stream.php b/tests/appending_to_implicitly_created_stream.php index 77708edc..2a984333 100644 --- a/tests/appending_to_implicitly_created_stream.php +++ b/tests/appending_to_implicitly_created_stream.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient; use PHPUnit\Framework\TestCase; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use ProophTest\EventStoreClient\Helper\EventsStream; use ProophTest\EventStoreClient\Helper\StreamWriter; @@ -105,7 +105,7 @@ public function sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e5_non_idempotent(): void $first6 = yield $writer->append($events); \assert($first6 instanceof TailWriter); try { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $first6->then($events[0], 6); } finally { $connection->close(); @@ -133,7 +133,7 @@ public function sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e4_wev(): void $first6 = yield $writer->append($events); \assert($first6 instanceof TailWriter); try { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $first6->then($events[0], 4); } finally { $connection->close(); @@ -386,7 +386,7 @@ public function sequence_S_0em1_1em1_E_S_0em1_1em1_2em1_E_idempotancy_fail(): vo $events[] = TestEvent::newTestEvent(); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); try { yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, $events); diff --git a/tests/appending_to_implicitly_created_stream_using_transaction.php b/tests/appending_to_implicitly_created_stream_using_transaction.php index dfb53343..24536383 100644 --- a/tests/appending_to_implicitly_created_stream_using_transaction.php +++ b/tests/appending_to_implicitly_created_stream_using_transaction.php @@ -14,7 +14,7 @@ namespace ProophTest\EventStoreClient; use PHPUnit\Framework\TestCase; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\WriteResult; use ProophTest\EventStoreClient\Helper\EventsStream; @@ -169,7 +169,7 @@ public function sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e6_wev(): void $ongoingTransaction = yield $ongoingTransaction->writeAsync([\current($events)]); \assert($ongoingTransaction instanceof OngoingTransaction); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $ongoingTransaction->commitAsync(); })); @@ -204,7 +204,7 @@ public function sequence_0em1_1e0_2e1_3e2_4e3_5e4_0e4_wev(): void $ongoingTransaction = yield $ongoingTransaction->writeAsync([\current($events)]); \assert($ongoingTransaction instanceof OngoingTransaction); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $ongoingTransaction->commitAsync(); })); @@ -393,7 +393,7 @@ public function sequence_S_0em1_1em1_E_S_0em1_1em1_2em1_E_idempotancy_fail(): vo $ongoingTransaction = yield $ongoingTransaction->writeAsync($events); \assert($ongoingTransaction instanceof OngoingTransaction); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $ongoingTransaction->commitAsync(); })); diff --git a/tests/connect_to_existing_persistent_subscription_with_max_one_client.php b/tests/connect_to_existing_persistent_subscription_with_max_one_client.php index febff7b9..aa98c375 100644 --- a/tests/connect_to_existing_persistent_subscription_with_max_one_client.php +++ b/tests/connect_to_existing_persistent_subscription_with_max_one_client.php @@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase; use Prooph\EventStore\AsyncEventStorePersistentSubscription; use Prooph\EventStore\EventAppearedOnAsyncPersistentSubscription; -use Prooph\EventStore\Exception\MaximumSubscribersReachedException; +use Prooph\EventStore\Exception\MaximumSubscribersReached; use Prooph\EventStore\PersistentSubscriptionSettings; use Prooph\EventStore\ResolvedEvent; use Prooph\EventStore\Util\Guid; @@ -127,7 +127,7 @@ public function the_first_subscription_connects_successfully(): void public function the_second_subscription_throws_maximum_subscribers_reached_exception(): void { $this->execute(function (): Generator { - $this->assertInstanceOf(MaximumSubscribersReachedException::class, $this->exception); + $this->assertInstanceOf(MaximumSubscribersReached::class, $this->exception); yield new Success(); }); } diff --git a/tests/connect_to_existing_persistent_subscription_without_permissions.php b/tests/connect_to_existing_persistent_subscription_without_permissions.php index e2d37f9f..019b703b 100644 --- a/tests/connect_to_existing_persistent_subscription_without_permissions.php +++ b/tests/connect_to_existing_persistent_subscription_without_permissions.php @@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase; use Prooph\EventStore\AsyncEventStorePersistentSubscription; use Prooph\EventStore\EventAppearedOnAsyncPersistentSubscription; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\PersistentSubscriptionSettings; use Prooph\EventStore\ResolvedEvent; use Prooph\EventStore\Util\Guid; @@ -73,7 +73,7 @@ public function __invoke( */ public function the_subscription_fails_to_connect_with_access_denied_exception(): void { - $this->expectException(AccessDeniedException::class); + $this->expectException(AccessDenied::class); $this->execute(function (): Generator { yield new Success(); diff --git a/tests/create_persistent_subscription_group_without_permissions.php b/tests/create_persistent_subscription_group_without_permissions.php index 8c82b747..26539d1e 100644 --- a/tests/create_persistent_subscription_group_without_permissions.php +++ b/tests/create_persistent_subscription_group_without_permissions.php @@ -16,7 +16,7 @@ use Amp\Success; use Generator; use PHPUnit\Framework\TestCase; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\PersistentSubscriptionSettings; use Prooph\EventStore\Util\Guid; use Throwable; @@ -60,7 +60,7 @@ public function the_completion_succeeds(): void $this->fail('Should have thrown'); } catch (Throwable $e) { - $this->assertInstanceOf(AccessDeniedException::class, $e); + $this->assertInstanceOf(AccessDenied::class, $e); } }); } diff --git a/tests/create_persistent_subscription_on_all_stream.php b/tests/create_persistent_subscription_on_all_stream.php index b68ba073..a6e26d43 100644 --- a/tests/create_persistent_subscription_on_all_stream.php +++ b/tests/create_persistent_subscription_on_all_stream.php @@ -16,7 +16,7 @@ use Amp\Success; use Generator; use PHPUnit\Framework\TestCase; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\PersistentSubscriptionSettings; use Throwable; @@ -56,7 +56,7 @@ public function the_completion_fails_with_invalid_stream(): void $this->fail('Should have thrown'); } catch (Throwable $e) { - $this->assertInstanceOf(AccessDeniedException::class, $e); + $this->assertInstanceOf(AccessDenied::class, $e); } }); } diff --git a/tests/deleting_persistent_subscription_group_without_permissions.php b/tests/deleting_persistent_subscription_group_without_permissions.php index 70a52773..1b6eab74 100644 --- a/tests/deleting_persistent_subscription_group_without_permissions.php +++ b/tests/deleting_persistent_subscription_group_without_permissions.php @@ -16,7 +16,7 @@ use Amp\Success; use Generator; use PHPUnit\Framework\TestCase; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\Util\Guid; use Throwable; @@ -44,7 +44,7 @@ protected function when(): Generator public function the_delete_fails_with_access_denied(): void { $this->execute(function () { - $this->expectException(AccessDeniedException::class); + $this->expectException(AccessDenied::class); yield $this->conn->deletePersistentSubscriptionAsync( $this->stream, diff --git a/tests/deleting_stream.php b/tests/deleting_stream.php index 2dcb3e50..59a713a6 100644 --- a/tests/deleting_stream.php +++ b/tests/deleting_stream.php @@ -15,8 +15,8 @@ use PHPUnit\Framework\TestCase; use Prooph\EventStore\DeleteResult; -use Prooph\EventStore\Exception\StreamDeletedException; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\StreamDeleted; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use ProophTest\EventStoreClient\Helper\TestConnection; use ProophTest\EventStoreClient\Helper\TestEvent; @@ -80,7 +80,7 @@ public function with_invalid_expected_version_should_fail(): void yield $connection->connectAsync(); try { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $connection->deleteStreamAsync($stream, 1, true); } finally { $connection->close(); @@ -129,7 +129,7 @@ public function which_was_already_deleted_should_fail(): void yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); try { - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); } finally { $connection->close(); diff --git a/tests/soft_delete.php b/tests/soft_delete.php index 1ebb2540..bb9c976b 100644 --- a/tests/soft_delete.php +++ b/tests/soft_delete.php @@ -18,8 +18,8 @@ use PHPUnit\Framework\TestCase; use Prooph\EventStore\AsyncEventStoreConnection; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\StreamDeletedException; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\StreamDeleted; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\RawStreamMetadataResult; use Prooph\EventStore\ResolvedEvent; @@ -438,7 +438,7 @@ public function soft_deleted_stream_can_be_hard_deleted(): void $this->assertTrue($meta->isStreamDeleted()); - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $this->conn->appendToStreamAsync( $stream, @@ -486,7 +486,7 @@ public function soft_deleted_stream_allows_recreation_only_for_first_write(): vo $this->fail('Should have thrown'); } catch (Throwable $e) { - $this->assertInstanceOf(WrongExpectedVersionException::class, $e); + $this->assertInstanceOf(WrongExpectedVersion::class, $e); } $result = yield $this->conn->readStreamEventsForwardAsync( diff --git a/tests/transaction.php b/tests/transaction.php index 0ff39d32..e54bbc2f 100644 --- a/tests/transaction.php +++ b/tests/transaction.php @@ -19,8 +19,8 @@ use Prooph\EventStore\AsyncEventStoreConnection; use Prooph\EventStore\AsyncEventStoreTransaction; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\StreamDeletedException; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\StreamDeleted; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\StreamEventsSlice; use Prooph\EventStore\WriteResult; @@ -116,7 +116,7 @@ public function should_fail_to_commit_non_existing_stream_with_wrong_exp_ver(): yield $transaction->writeAsync([TestEvent::newTestEvent()]); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $transaction->commitAsync(); }); @@ -205,7 +205,7 @@ public function should_validate_expectations_on_commit(): void yield $transaction->writeAsync([TestEvent::newTestEvent()]); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $transaction->commitAsync(); }); @@ -284,7 +284,7 @@ public function should_fail_to_commit_if_started_with_correct_ver_but_committing yield $transaction->writeAsync([TestEvent::newTestEvent()]); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $transaction->commitAsync(); }); @@ -335,7 +335,7 @@ public function should_fail_to_commit_if_started_with_correct_ver_but_on_commit_ yield $this->conn->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $transaction->commitAsync(); }); diff --git a/tests/update_existing_persistent_subscription_without_permissions.php b/tests/update_existing_persistent_subscription_without_permissions.php index 6af6648e..dd5375c0 100644 --- a/tests/update_existing_persistent_subscription_without_permissions.php +++ b/tests/update_existing_persistent_subscription_without_permissions.php @@ -16,7 +16,7 @@ use Generator; use PHPUnit\Framework\TestCase; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\AccessDeniedException; +use Prooph\EventStore\Exception\AccessDenied; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\PersistentSubscriptionSettings; use Prooph\EventStore\Util\Guid; @@ -60,7 +60,7 @@ protected function given(): Generator public function the_completion_fails_with_access_denied(): void { $this->execute(function () { - $this->expectException(AccessDeniedException::class); + $this->expectException(AccessDenied::class); yield $this->conn->updatePersistentSubscriptionAsync( $this->stream, diff --git a/tests/when_committing_empty_transaction.php b/tests/when_committing_empty_transaction.php index 65e883a3..0a494ffc 100644 --- a/tests/when_committing_empty_transaction.php +++ b/tests/when_committing_empty_transaction.php @@ -18,7 +18,7 @@ use Prooph\EventStore\AsyncEventStoreConnection; use Prooph\EventStore\AsyncEventStoreTransaction; use Prooph\EventStore\EventData; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\SliceReadStatus; use Prooph\EventStore\StreamEventsSlice; @@ -190,7 +190,7 @@ public function trying_to_append_new_events_with_expected_version_no_stream_fail wait(call(function () { yield from $this->bootstrap(); - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $this->connection->appendToStreamAsync( $this->stream, diff --git a/tests/when_working_with_raw_stream_metadata.php b/tests/when_working_with_raw_stream_metadata.php index 10f5f83a..1e1a38f8 100644 --- a/tests/when_working_with_raw_stream_metadata.php +++ b/tests/when_working_with_raw_stream_metadata.php @@ -16,8 +16,8 @@ use Generator; use PHPUnit\Framework\TestCase; use Prooph\EventStore\AsyncEventStoreConnection; -use Prooph\EventStore\Exception\StreamDeletedException; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\StreamDeleted; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\RawStreamMetadataResult; use ProophTest\EventStoreClient\Helper\TestConnection; @@ -108,7 +108,7 @@ public function setting_metadata_few_times_returns_last_metadata(): void public function trying_to_set_metadata_with_wrong_expected_version_fails(): void { $this->execute(function () { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $this->conn->setStreamMetadataAsync( $this->stream, @@ -211,7 +211,7 @@ public function setting_metadata_for_deleted_stream_throws_stream_deleted_except true ); - $this->expectException(StreamDeletedException::class); + $this->expectException(StreamDeleted::class); yield $this->conn->setStreamMetadataAsync( $this->stream, diff --git a/tests/when_working_with_stream_metadata_as_structured_info.php b/tests/when_working_with_stream_metadata_as_structured_info.php index fc6a0075..6750b1c3 100644 --- a/tests/when_working_with_stream_metadata_as_structured_info.php +++ b/tests/when_working_with_stream_metadata_as_structured_info.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\TestCase; use Prooph\EventStore\AsyncEventStoreConnection; use Prooph\EventStore\Exception\RuntimeException; -use Prooph\EventStore\Exception\WrongExpectedVersionException; +use Prooph\EventStore\Exception\WrongExpectedVersion; use Prooph\EventStore\ExpectedVersion; use Prooph\EventStore\RawStreamMetadataResult; use Prooph\EventStore\StreamMetadata; @@ -129,7 +129,7 @@ public function setting_metadata_few_times_returns_last_metadata_info(): void public function trying_to_set_metadata_with_wrong_expected_version_fails(): void { $this->execute(function () { - $this->expectException(WrongExpectedVersionException::class); + $this->expectException(WrongExpectedVersion::class); yield $this->conn->setStreamMetadataAsync( $this->stream,