Skip to content

Commit

Permalink
Apply coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
othillo committed Mar 19, 2024
1 parent 0cb891b commit e4b5c4d
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function accepting_an_accepted_invite_yields_no_change()
*/
public function an_accepted_invite_cannot_be_declined()
{
$this->expectException(\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Already accepted');

$id = $this->generator->generate();
Expand Down Expand Up @@ -133,7 +133,7 @@ public function declining_a_declined_invite_yields_no_change()
*/
public function a_declined_invite_cannot_be_accepted()
{
$this->expectException(\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Already declined');

$id = $this->generator->generate();
Expand Down
4 changes: 2 additions & 2 deletions examples/event-sourced-domain-with-tests/InvitesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function accepting_an_accepted_invite_yields_no_change()
*/
public function an_accepted_invite_cannot_be_declined()
{
$this->expectException(\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Already accepted');

$id = $this->generator->generate();
Expand Down Expand Up @@ -138,7 +138,7 @@ public function declining_a_declined_invite_yields_no_change()
*/
public function a_declined_invite_cannot_be_accepted()
{
$this->expectException(\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Already declined');

$id = $this->generator->generate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getAggregateRootId(): string
public function heldJob($jobId, $title, $description)
{
if (array_key_exists($jobId, $this->jobs)) {
throw new \InvalidArgumentException("Job {$jobId} already assigned to this job seeker.");
throw new InvalidArgumentException("Job {$jobId} already assigned to this job seeker.");
}
$this->apply(new JobWasAddedToJobSeekerEvent($this->jobSeekerId, $jobId, $title, $description));
}
Expand All @@ -58,7 +58,7 @@ public function removeAccidentallyAddedJob($jobId)
public function describeJob($jobId, $title, $description)
{
if (!array_key_exists($jobId, $this->jobs)) {
throw new \InvalidArgumentException("Job {$jobId} is not assigned to this job seeker.");
throw new InvalidArgumentException("Job {$jobId} is not assigned to this job seeker.");
}
$this->jobs[$jobId]->describe($title, $description);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function it_can_remove_an_accidentally_added_job()
*/
public function it_cannot_add_the_same_job_if_job_is_already_assigned()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Job job-000 already assigned to this job seeker');

$id = $this->generator->generate();
Expand All @@ -200,7 +200,7 @@ public function it_cannot_add_the_same_job_if_job_is_already_assigned()
*/
public function it_cannot_describe_a_job_it_knows_nothing_about()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Job job-000 is not assigned to this job seeker');

$id = $this->generator->generate();
Expand Down
2 changes: 1 addition & 1 deletion examples/upcasting/UserCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

class UserCreated implements \Broadway\Serializer\Serializable
class UserCreated implements Broadway\Serializer\Serializable
{
public $userId;
public $name;
Expand Down
2 changes: 1 addition & 1 deletion examples/upcasting/UserCreatedV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

class UserCreatedV2 implements \Broadway\Serializer\Serializable
class UserCreatedV2 implements Broadway\Serializer\Serializable
{
public $userId;
public $name;
Expand Down
2 changes: 1 addition & 1 deletion examples/upcasting/UserCreatedV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

class UserCreatedV3 implements \Broadway\Serializer\Serializable
class UserCreatedV3 implements Broadway\Serializer\Serializable
{
public $userId;
public $name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function setUp(): void
$this->createAndInsertEventFixtures();
}

protected function visitEvents(Criteria $criteria = null)
protected function visitEvents(?Criteria $criteria = null)
{
$eventVisitor = new RecordingEventVisitor();

Expand Down
4 changes: 2 additions & 2 deletions src/Broadway/EventStore/Testing/EventStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ public function idDataProvider()
];
}

protected function createDomainMessage($id, int $playhead, DateTime $recordedOn = null)
protected function createDomainMessage($id, int $playhead, ?DateTime $recordedOn = null)
{
return new DomainMessage($id, $playhead, new MetaData([]), new Event(), $recordedOn ? $recordedOn : DateTime::now());
return new DomainMessage($id, $playhead, new Metadata([]), new Event(), $recordedOn ? $recordedOn : DateTime::now());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Broadway/ReadModel/Testing/Scenario.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function given(array $events = []): self
return $this;
}

public function when($event, DateTime $occurredOn = null): self
public function when($event, ?DateTime $occurredOn = null): self
{
$this->projector->handle($this->createDomainMessageForEvent($event, $occurredOn));

Expand Down
5 changes: 1 addition & 4 deletions src/Broadway/Repository/AggregateNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
*/
final class AggregateNotFoundException extends \RuntimeException
{
/**
* @param \Exception $previous
*/
public static function create($id, \Exception $previous = null): self
public static function create($id, ?\Exception $previous = null): self
{
return new self(sprintf("Aggregate with id '%s' not found", $id), 0, $previous);
}
Expand Down

0 comments on commit e4b5c4d

Please sign in to comment.