marc-mabe / php-enum

Simple and fast implementation of enumerations with native PHP
BSD 3-Clause "New" or "Revised" License
464 stars 36 forks source link

Added purity markers for enumerables, improved type definitions #140

Closed Ocramius closed 4 years ago

Ocramius commented 4 years ago

This patch introduces a few improvements on the codebase:

I kept very conservative on type definitions: I wanted to restrict also on ::has() and ::get(), but that would introduce downstream issues, such as ::has($unknown) failing due to missing upfront assertions.

Note: this is compatible with #138 too.

Ocramius commented 4 years ago

Succeeded: not sure why CI failed to report status.

https://travis-ci.org/github/marc-mabe/php-enum/builds/670092398

Ocramius commented 4 years ago

:heavy_check_mark: https://travis-ci.org/github/marc-mabe/php-enum/builds/670098448

marc-mabe commented 4 years ago

Thanks @Ocramius, I highly appreciate your contribution :+1:

Ocramius commented 4 years ago

Awesome, thanks! \o/

Could you cut a minor with this one, when you got time?

Thanks!

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On Sun, Apr 5, 2020 at 12:44 PM Marc Bennewitz notifications@github.com wrote:

Merged #140 https://github.com/marc-mabe/php-enum/pull/140 into master.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/marc-mabe/php-enum/pull/140#event-3202110677, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFVEAUP2UEARDOFSBEMF3RLBOHJANCNFSM4L2JRIPQ .

marc-mabe commented 4 years ago

Hi @Ocramius, I have created an RC release now including generic types. Please check if everything works as expected.

Ocramius commented 4 years ago

Trying it out, thanks!

Ocramius commented 4 years ago

Tried on a downstream codebase that relies on vimeo/psalm: seems to be all good, although I didn't add any specific types that rely on the new generics :-)

marc-mabe commented 4 years ago

Thanks! I'll try that on two projects using PHPStan this week and if everything is fine I create a stable release.