File tree Expand file tree Collapse file tree 3 files changed +21
-21
lines changed
Expand file tree Collapse file tree 3 files changed +21
-21
lines changed Original file line number Diff line number Diff line change @@ -384,14 +384,14 @@ public function getTraits(): array
384384 {
385385 $ traits = $ this ->betterReflectionClass ->getTraits ();
386386
387- /** @var list<trait-string> $traitNames */
388- $ traitNames = array_map (static fn (BetterReflectionClass $ trait ): string => $ trait ->getName (), $ traits );
387+ $ traitsByName = [];
388+ foreach ($ traits as $ trait ) {
389+ /** @var trait-string $traitName */
390+ $ traitName = $ trait ->getName ();
391+ $ traitsByName [$ traitName ] = new self ($ trait );
392+ }
389393
390- /** @psalm-suppress ImpureFunctionCall */
391- return array_combine (
392- $ traitNames ,
393- array_map (static fn (BetterReflectionClass $ trait ): self => new self ($ trait ), $ traits ),
394- );
394+ return $ traitsByName ;
395395 }
396396
397397 /**
Original file line number Diff line number Diff line change @@ -312,14 +312,14 @@ public function getTraits(): array
312312 {
313313 $ traits = $ this ->betterReflectionEnum ->getTraits ();
314314
315- /** @var list<trait-string> $traitNames */
316- $ traitNames = array_map (static fn (BetterReflectionClass $ trait ): string => $ trait ->getName (), $ traits );
315+ $ traitsByName = [];
316+ foreach ($ traits as $ trait ) {
317+ /** @var trait-string $traitName */
318+ $ traitName = $ trait ->getName ();
319+ $ traitsByName [$ traitName ] = new ReflectionClass ($ trait );
320+ }
317321
318- /** @psalm-suppress ImpureFunctionCall */
319- return array_combine (
320- $ traitNames ,
321- array_map (static fn (BetterReflectionClass $ trait ): ReflectionClass => new ReflectionClass ($ trait ), $ traits ),
322- );
322+ return $ traitsByName ;
323323 }
324324
325325 /** @return list<trait-string> */
Original file line number Diff line number Diff line change @@ -316,14 +316,14 @@ public function getTraits(): array
316316 {
317317 $ traits = $ this ->betterReflectionObject ->getTraits ();
318318
319- /** @var list<trait-string> $traitNames */
320- $ traitNames = array_map (static fn (BetterReflectionClass $ trait ): string => $ trait ->getName (), $ traits );
319+ $ traitsByName = [];
320+ foreach ($ traits as $ trait ) {
321+ /** @var trait-string $traitName */
322+ $ traitName = $ trait ->getName ();
323+ $ traitsByName [$ traitName ] = new ReflectionClass ($ trait );
324+ }
321325
322- /** @psalm-suppress ImpureFunctionCall */
323- return array_combine (
324- $ traitNames ,
325- array_map (static fn (BetterReflectionClass $ trait ): ReflectionClass => new ReflectionClass ($ trait ), $ traits ),
326- );
326+ return $ traitsByName ;
327327 }
328328
329329 /**
You can’t perform that action at this time.
0 commit comments