stable

Clone or download

Read-only

Closes request #27885: Relax mutation-free constraint on map() and mapErr()

No functional change expected. Having those methods mutation-free was originally needed so that we could use @template-covariant. It is far too restricting to have those methods mutation-free (as it means we can only call other mutation-free functions). It sort of defeats the purpose of Ok|Err, as pure functions cannot really fail or at least not in the way that database queries and HTTP calls can fail. Since all methods are not mutation-free, we cannot use @template-covariant anymore, so there is no reason to keep those methods mutation-free. We should relax the constraint on map() and mapErr() too as it makes them way too hard to use. Change-Id: I2a9cc1fba8a6127db0d6b97db5ef81e58990b4b6

Modified Files

Name
M src/common/NeverThrow/Err.php +2 −2 Go to diff View file
M src/common/NeverThrow/IResult.php +0 −2 Go to diff View file
M src/common/NeverThrow/Ok.php +2 −2 Go to diff View file