@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | 8 | * @param array $arrayState |
| 9 | - * @return MessageInterface |
|
| 9 | + * @return FromArrayTrait |
|
| 10 | 10 | */ |
| 11 | 11 | public static function fromArray(array $arrayState): MessageInterface |
| 12 | 12 | { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | public static function fromArray(array $arrayState): MessageInterface |
| 12 | 12 | { |
| 13 | 13 | $classReflection = new \ReflectionClass(static::class); |
| 14 | - $classes = [ $classReflection ]; |
|
| 14 | + $classes = [$classReflection]; |
|
| 15 | 15 | $parent = $classReflection; |
| 16 | 16 | while ($parent = $parent->getParentClass()) { |
| 17 | 17 | $classes[] = $parent; |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | $factoryMethod = $matches[1]; |
| 33 | 33 | if ($factoryMethod === '$ctor') { |
| 34 | - $valueFactories[$propName] = function ($value) use ($valueImplementor) { |
|
| 34 | + $valueFactories[$propName] = function($value) use ($valueImplementor) { |
|
| 35 | 35 | return new $valueImplementor($value); |
| 36 | 36 | }; |
| 37 | 37 | } else { |
| 38 | - $valueFactories[$propName] = [ $valueImplementor, $factoryMethod ]; |
|
| 38 | + $valueFactories[$propName] = [$valueImplementor, $factoryMethod]; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | return array_reduce( |
| 87 | 87 | $this->metadataEnrichers->toArray(), |
| 88 | - function (Metadata $metadata, MetadataEnricherInterface $metadataEnricher) { |
|
| 88 | + function(Metadata $metadata, MetadataEnricherInterface $metadataEnricher) { |
|
| 89 | 89 | return $metadataEnricher->enrich($metadata); |
| 90 | 90 | }, |
| 91 | 91 | $metadata |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | $classProps = $reflectionClass->getProperties(); |
| 15 | 15 | foreach ($classProps as $prop) { |
| 16 | 16 | $propName = $prop->getName(); |
| 17 | - $propGetter = [ $this, "get".ucfirst($propName) ]; |
|
| 17 | + $propGetter = [$this, "get".ucfirst($propName)]; |
|
| 18 | 18 | if (!is_callable($propGetter)) { |
| 19 | 19 | continue; |
| 20 | 20 | } |
| 21 | 21 | $propVal = call_user_func($propGetter); |
| 22 | - $toNative = [ $propVal, "toNative" ]; |
|
| 23 | - $toArray = [ $propVal, "toArray" ]; |
|
| 22 | + $toNative = [$propVal, "toNative"]; |
|
| 23 | + $toArray = [$propVal, "toArray"]; |
|
| 24 | 24 | if (is_callable($toNative)) { |
| 25 | 25 | $data[$propName] = call_user_func($toNative); |
| 26 | 26 | } elseif (is_callable($toArray)) { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function __construct(array $subscriptions = []) |
| 15 | 15 | { |
| 16 | - $this->init(array_reduce($subscriptions, function (array $carry, SubscriptionInterface $subscription) { |
|
| 16 | + $this->init(array_reduce($subscriptions, function(array $carry, SubscriptionInterface $subscription) { |
|
| 17 | 17 | $carry[$subscription->getKey()] = $subscription; // enforce consistent channel keys |
| 18 | 18 | return $carry; |
| 19 | 19 | }, []), SubscriptionInterface::CLASS); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->messageHandlers = $messageHandlers; |
| 59 | 59 | $this->guard = $guard; |
| 60 | 60 | $this->metadataEnrichers = ($metadataEnrichers ?? new MetadataEnricherList) |
| 61 | - ->push(new CallbackMetadataEnricher(function (Metadata $metadata): Metadata { |
|
| 61 | + ->push(new CallbackMetadataEnricher(function(Metadata $metadata): Metadata { |
|
| 62 | 62 | return $metadata->with(self::METADATA_KEY, $this->getKey()); |
| 63 | 63 | })); |
| 64 | 64 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | return $envelope->withMetadata(array_reduce( |
| 108 | 108 | $this->metadataEnrichers->toArray(), |
| 109 | - function (Metadata $metadata, MetadataEnricherInterface $metadataEnricher) { |
|
| 109 | + function(Metadata $metadata, MetadataEnricherInterface $metadataEnricher) { |
|
| 110 | 110 | return $metadataEnricher->enrich($metadata); |
| 111 | 111 | }, |
| 112 | 112 | $envelope->getMetadata() |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function __construct(array $channels = []) |
| 15 | 15 | { |
| 16 | - $this->init(array_reduce($channels, function (array $carry, ChannelInterface $channel) { |
|
| 16 | + $this->init(array_reduce($channels, function(array $carry, ChannelInterface $channel) { |
|
| 17 | 17 | $carry[$channel->getKey()] = $channel; // enforce consistent channel keys |
| 18 | 18 | return $carry; |
| 19 | 19 | }, []), ChannelInterface::CLASS); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->subscriptions = $subscriptions; |
| 52 | 52 | $this->guard = $guard; |
| 53 | 53 | $this->metadataEnrichers = ($metadataEnrichers ?? new MetadataEnricherList) |
| 54 | - ->push(new CallbackMetadataEnricher(function (Metadata $metadata): Metadata { |
|
| 54 | + ->push(new CallbackMetadataEnricher(function(Metadata $metadata): Metadata { |
|
| 55 | 55 | return $metadata->with(self::METADATA_KEY, $this->getKey()); |
| 56 | 56 | })); |
| 57 | 57 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | return $envelope->withMetadata(array_reduce( |
| 113 | 113 | $this->metadataEnrichers->toArray(), |
| 114 | - function (Metadata $metadata, MetadataEnricherInterface $metadataEnricher) { |
|
| 114 | + function(Metadata $metadata, MetadataEnricherInterface $metadataEnricher) { |
|
| 115 | 115 | return $metadataEnricher->enrich($metadata); |
| 116 | 116 | }, |
| 117 | 117 | $envelope->getMetadata() |