Skip to content

Commit

Permalink
php cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Aug 22, 2018
1 parent 09c58b6 commit f7f5568
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Event/DefaultActionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public function setTarget($target): void
*/
public function setParams($params): void
{
if (! is_array($params) && ! $params instanceof \ArrayAccess) {
throw new \InvalidArgumentException('Event params are invalid. Expected type is array or \\ArrayAccess. Got ' . gettype($params));
if (! \is_array($params) && ! $params instanceof \ArrayAccess) {
throw new \InvalidArgumentException('Event params are invalid. Expected type is array or \\ArrayAccess. Got ' . \gettype($params));
}

$this->params = $params;
Expand Down
4 changes: 2 additions & 2 deletions src/Event/ProophActionEventEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function dispatchUntil(ActionEvent $event, callable $callback): void
*/
public function attachListener(string $event, callable $listener, int $priority = 1): ListenerHandler
{
if (! empty($this->availableEventNames) && ! in_array($event, $this->availableEventNames, true)) {
if (! empty($this->availableEventNames) && ! \in_array($event, $this->availableEventNames, true)) {
throw new \InvalidArgumentException("Unknown event name given: $event");
}

Expand Down Expand Up @@ -135,7 +135,7 @@ private function getListeners(ActionEvent $event): iterable
{
$prioritizedListeners = $this->events[$event->getName()] ?? [];

krsort($prioritizedListeners, SORT_NUMERIC);
\krsort($prioritizedListeners, SORT_NUMERIC);

foreach ($prioritizedListeners as $listenersByPriority) {
foreach ($listenersByPriority as $listenerHandler) {
Expand Down
4 changes: 2 additions & 2 deletions src/Messaging/DomainMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function fromArray(array $messageData): DomainMessage
{
MessageDataAssertion::assert($messageData);

$messageRef = new \ReflectionClass(get_called_class());
$messageRef = new \ReflectionClass(\get_called_class());

/** @var $message DomainMessage */
$message = $messageRef->newInstanceWithoutConstructor();
Expand All @@ -70,7 +70,7 @@ protected function init(): void
}

if ($this->messageName === null) {
$this->messageName = get_class($this);
$this->messageName = \get_class($this);
}

if ($this->createdAt === null) {
Expand Down
6 changes: 3 additions & 3 deletions src/Messaging/FQCNMessageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class FQCNMessageFactory implements MessageFactory
{
public function createMessageFromArray(string $messageName, array $messageData): Message
{
if (! class_exists($messageName)) {
if (! \class_exists($messageName)) {
throw new \UnexpectedValueException('Given message name is not a valid class: ' . (string) $messageName);
}

if (! is_subclass_of($messageName, DomainMessage::class)) {
throw new \UnexpectedValueException(sprintf(
if (! \is_subclass_of($messageName, DomainMessage::class)) {
throw new \UnexpectedValueException(\sprintf(
'Message class %s is not a sub class of %s',
$messageName,
DomainMessage::class
Expand Down
8 changes: 4 additions & 4 deletions src/Messaging/MessageDataAssertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function assertPayload($payload): void
*/
private static function assertSubPayload($payload): void
{
if (is_array($payload)) {
if (\is_array($payload)) {
foreach ($payload as $subPayload) {
self::assertSubPayload($subPayload);
}
Expand All @@ -76,16 +76,16 @@ public static function assertMetadata($metadata): void

foreach ($metadata as $key => $value) {
Assertion::minLength($key, 1, 'A metadata key must be non empty string');
Assertion::scalar($value, 'A metadata value must have a scalar type. Got ' . gettype($value) . ' for ' . $key);
Assertion::scalar($value, 'A metadata value must have a scalar type. Got ' . \gettype($value) . ' for ' . $key);
}
}

public static function assertCreatedAt($createdAt): void
{
Assertion::isInstanceOf($createdAt, DateTimeImmutable::class, sprintf(
Assertion::isInstanceOf($createdAt, DateTimeImmutable::class, \sprintf(
'created_at must be of type %s. Got %s',
DateTimeImmutable::class,
is_object($createdAt) ? get_class($createdAt) : gettype($createdAt)
\is_object($createdAt) ? \get_class($createdAt) : \gettype($createdAt)
));
}
}

0 comments on commit f7f5568

Please sign in to comment.