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

Make IntegerRangeType constructor private #1624

Merged
merged 1 commit into from Aug 16, 2022

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Aug 15, 2022

I was blindly following that comment (see diff), but tbh I did not fully understand it. Is it fine to do this or should it be rather deprecated via phpdoc?

Something should be done I think to avoid people using it instead of the static create function.

@herndlm herndlm marked this pull request as ready for review August 15, 2022 15:01
@ondrejmirtes
Copy link
Member

I'm delighted! I totally missed this when bumping to 7.2+ :)

It's fine to make it private because currently for new IntegerRangeType(1, 5) we report this:

 ------ ----------------------------------------------------------------------------------------------
  Line   test.php
 ------ ----------------------------------------------------------------------------------------------
  3      Creating new PHPStan\Type\IntegerRangeType is not covered by backward compatibility promise.
         The class might change in a minor PHPStan version.

@ondrejmirtes ondrejmirtes merged commit bd971db into phpstan:1.8.x Aug 16, 2022
@ondrejmirtes
Copy link
Member

Thank you.

@herndlm herndlm deleted the integer-range-type-constructor branch August 16, 2022 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants