Skip to content

More specific type for 'port' component of 'parse_url()'#1622

Merged
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
thg2k:pr/parse_url_intrange
Aug 16, 2022
Merged

More specific type for 'port' component of 'parse_url()'#1622
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
thg2k:pr/parse_url_intrange

Conversation

@thg2k
Copy link
Copy Markdown
Contributor

@thg2k thg2k commented Aug 15, 2022

The port component can only be in the range 0-65535:

<?php
var_dump(parse_url("http://localhost:-1/"));    // false
var_dump(parse_url("http://localhost:0/"));     // [ ... ]
var_dump(parse_url("http://localhost:65535/")); // [ ... ]
var_dump(parse_url("http://localhost:65536/")); // false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use IntegerRangeType::fromInterval(...)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, brb opening a PR that prevents that :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've never guessed that! Force-pushed with the requested change.

@thg2k thg2k force-pushed the pr/parse_url_intrange branch from e2e38c9 to 9775464 Compare August 15, 2022 15:40
@thg2k thg2k force-pushed the pr/parse_url_intrange branch from 9775464 to 547e608 Compare August 16, 2022 08:33
@thg2k
Copy link
Copy Markdown
Contributor Author

thg2k commented Aug 16, 2022

I'm sorry I just realized I missed a couple of tests, gotta love that CI.

Made another force push to fix that, let me know if there are other outstanding issues.

@ondrejmirtes
Copy link
Copy Markdown
Member

gotta love that CI.

Yeah, I'm super-proud of that, thanks :)

And thanks for this PR!

@ondrejmirtes ondrejmirtes merged commit 4add218 into phpstan:1.8.x Aug 16, 2022
@thg2k thg2k deleted the pr/parse_url_intrange branch August 16, 2022 11:39
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.

4 participants