Skip to content

Make IntegerRangeType constructor private#1624

Merged
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
herndlm:integer-range-type-constructor
Aug 16, 2022
Merged

Make IntegerRangeType constructor private#1624
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
herndlm:integer-range-type-constructor

Conversation

@herndlm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

2 participants