Skip to content

Conversation

thg2k
Copy link
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

@@ -122,17 +122,17 @@ private function cacheReturnTypes(): void
}

$string = new StringType();
$integer = new IntegerType();
$port = new IntegerRangeType(0, 65535);
Copy link
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
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
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
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
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