Skip to content

Commit caee04b

Browse files
committed
Mark toArray as pure and force psalm to accept it
Lie to Psalm and tell it that toArray is immmutable. This seems tolerable (despite how bad a practice overriding the typechecker is) because the mutation is entirely memoization. If PHP were a lazy language, no caching would be necessary in the first place.
1 parent f24ac13 commit caee04b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Enum.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public function getKey()
8686

8787
/**
8888
* @psalm-pure
89+
* @psalm-suppress InvalidCast
8990
* @return string
9091
*/
9192
public function __toString()

0 commit comments

Comments
 (0)