Skip to content
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

Add int type aliases based on existing codes #8530

Merged
merged 5 commits into from Oct 5, 2022
Merged

Add int type aliases based on existing codes #8530

merged 5 commits into from Oct 5, 2022

Conversation

hamburnyog
Copy link
Contributor

@hamburnyog hamburnyog commented Oct 4, 2022

#8062

@AndrolGenhald @orklah I made a pr for this. however, I've noticed in the comment that this will be deprecated. I am wondering if this is still needed?

@orklah
Copy link
Collaborator

orklah commented Oct 4, 2022

Hey! Thanks for this work!

Aliases are fine, what we're deprecating is not positive-int but the type TPositiveInt. It simply means that any negative-int will just be an alias for int<min, -1> so your TNegativeInt is not needed as it will be replaced with a new TIntRange(null, -1);.

So if you want to make the change, your PR is welcome :)

(Note: the removal of TPositiveInt and migration to TIntRange was done on the master branch but you can still add the aliases on 4.x to be able to use them before the Psalm 5 release)

@hamburnyog
Copy link
Contributor Author

I see 👍, I made some changes. Hopefully I get it this time. Thanks for your response!

@orklah
Copy link
Collaborator

orklah commented Oct 5, 2022

Almost perfect :)

There's a slight difference between negative-int and non-positive-int because 0 is neither positive or negative.

Which means negative-int won't contain 0 but non-positive-int does !

The same rule applies between positive-int and non-negative-int

@hamburnyog
Copy link
Contributor Author

I've made some updates, kindly check if you have free time. Thanks!

@orklah orklah added the release:feature The PR will be included in 'Features' section of the release notes label Oct 5, 2022
@orklah
Copy link
Collaborator

orklah commented Oct 5, 2022

Thanks!

cc @ondrejmirtes we added some aliases for parity with positive-int, not sure if those already exists in phpstan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature The PR will be included in 'Features' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants