-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added purity markers for enumerables, improved type definitions #140
Conversation
@@ -1,75 +1,76 @@ | |||
sudo: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what happened here: was the file commited with \r\n
before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea how this happened
|
||
# run benchmarks to make sure they are working fine | ||
- php vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 | ||
- vendor/bin/psalm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only addition here
5d80683
to
c7d61a5
Compare
Succeeded: not sure why CI failed to report status. https://travis-ci.org/github/marc-mabe/php-enum/builds/670092398 |
c7d61a5
to
c2c18a6
Compare
Thanks @Ocramius, |
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 ***@***.***> wrote:
Merged #140 <#140> into master.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#140 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABFVEAUP2UEARDOFSBEMF3RLBOHJANCNFSM4L2JRIPQ>
.
|
Hi @Ocramius, |
Trying it out, thanks! |
Tried on a downstream codebase that relies on |
Thanks! |
This patch introduces a few improvements on the codebase:
vimeo/psalm
minimal tests (not testing sources, just declared API)@psalm-pure
and@psalm-immutable
to enumerable types, allowing usage ofEnum
in functionally pure (type-checked) contextsnon-empty-string
vsstring
, where applicable)psalm.xml
from exports)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.