-
Notifications
You must be signed in to change notification settings - Fork 542
Implement SocketCreateReturnTypeExtension #3667
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
Conversation
48a48c8
to
16ba677
Compare
This pull request has been marked as ready for review. |
broken build is unrelated |
be7173c
to
5fbfc32
Compare
just found https://php.watch/versions/8.0/sockets-sockets-addressinfo which describes all functions which have been changed from |
b0ccacc
to
48543d1
Compare
This pull request has been marked as ready for review. |
48543d1
to
1ef8b62
Compare
1ef8b62
to
c6a6860
Compare
c6a6860
to
13eaee7
Compare
I'm hesitant to merge this. If PHPStan were to properly merge reflection data across multiple supported PHP versions then this PR wouldn't be needed at all. It's really weird to implement this for a single function when the rest of PHPStan doesn't really support this. |
I agree. I think PHPStan should have its own meta-type that automatically resolves to the correct type (i.e. resource/object) according to the current php version. At the moment i'm happily using this hack: phpstan/phpstan#4212 (comment) The problem is that it works only within the same project, i.e. as the phpstan.neon file is local to the project it does not "export" easily, so for methods facing externally I have to type it as "mixed". These are the type aliases i'm currently using:
Also note that some types have been introduced in different versions, so for example GdImage and Socket are 8.0 while GdFont is 8.1 |
php-version dependent
socket_create
handling to ease writing cross php version coderefs phpstan/phpstan#4212
see https://php.watch/versions/8.0/sockets-sockets-addressinfo