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

Implement SocketCreateReturnTypeExtension #3667

Open
wants to merge 6 commits into
base: 2.0.x
Choose a base branch
from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Nov 25, 2024

php-version dependent socket_create handling to ease writing cross php version code

refs phpstan/phpstan#4212

see https://php.watch/versions/8.0/sockets-sockets-addressinfo

@staabm staabm force-pushed the socket_create branch 2 times, most recently from 48a48c8 to 16ba677 Compare November 26, 2024 08:11
@staabm staabm marked this pull request as ready for review November 26, 2024 08:23
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@@ -28,4 +28,9 @@ public function producesWarningForFinalPrivateMethods(): TrinaryLogic
return IntegerRangeType::fromInterval(80000, null)->isSuperTypeOf($this->phpVersions)->result;
}

public function socketCreateUsesResource(): TrinaryLogic
{
return IntegerRangeType::fromInterval(null, 79999)->isSuperTypeOf($this->phpVersions)->result;
Copy link
Member

Choose a reason for hiding this comment

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

I'd write this as "since 8.0" rather than until "7.9999". So rename this method to what it actually returns since 8.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

@staabm
Copy link
Contributor Author

staabm commented Nov 26, 2024

broken build is unrelated

@staabm
Copy link
Contributor Author

staabm commented Nov 26, 2024

just found https://php.watch/versions/8.0/sockets-sockets-addressinfo which describes all functions which have been changed from resource to Socket-objects.
I have double checked the php.net manual for all of them and it turned out they have the same parameter signature so we can re-use the extension for all of them.

@staabm staabm marked this pull request as ready for review November 26, 2024 19:01
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

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.

3 participants