File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -249,17 +249,15 @@ public function getEventChain() : array
249249 * @return Event|null
250250 */
251251 public function getFirstEvent () : ?Event {
252- $ lastKey = array_key_first ($ this ->consumedEvents );
253- return ($ lastKey === null ) ? null : $ this ->consumedEvents [$ lastKey ];
252+ return $ this ->consumedEvents [array_key_first ($ this ->consumedEvents )] ?? null ;
254253 }
255254
256255 /**
257256 * Get the most recent (last) event we handled
258257 * @return Event|null
259258 */
260259 public function getLastEvent () : ?Event {
261- $ firstKey = array_key_first ($ this ->consumedEvents );
262- return ($ firstKey === null ) ? null : $ this ->consumedEvents [$ firstKey ];
260+ return $ this ->consumedEvents [array_key_last ($ this ->consumedEvents )] ?? null ;
263261 }
264262
265263 /**
@@ -307,7 +305,7 @@ public function trimEventChain(int $length) : void
307305 */
308306 public function firstEventDateTime (): ?DateTimeInterface
309307 {
310- return $ this ->consumedEvents [array_key_first ($ this ->consumedEvents )]?->datetime;
308+ return ( $ this ->consumedEvents [array_key_first ($ this ->consumedEvents )] ?? null ) ?->datetime;
311309 }
312310
313311 /**
@@ -316,7 +314,7 @@ public function firstEventDateTime(): ?DateTimeInterface
316314 */
317315 public function lastSeenEventDateTime (): ?DateTimeInterface
318316 {
319- return $ this ->consumedEvents [array_key_last ($ this ->consumedEvents )]?->datetime;
317+ return ( $ this ->consumedEvents [array_key_last ($ this ->consumedEvents )] ?? null ) ?->datetime;
320318 }
321319
322320 /**
You can’t perform that action at this time.
0 commit comments