Skip to content

Add missing ssh2_* signatures #4121

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

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from

Conversation

@VincentLanglet VincentLanglet force-pushed the fix/ssh2 branch 2 times, most recently from cfa40b6 to f501ae4 Compare July 19, 2025 15:17
@ondrejmirtes
Copy link
Member

I don't think we need this? https://phpstan.org/r/16bc844a-19ef-458e-a77a-ef78aed7cf0f

@VincentLanglet
Copy link
Contributor Author

I don't think we need this? phpstan.org/r/16bc844a-19ef-458e-a77a-ef78aed7cf0f

The definition seems really wrong:
https://phpstan.org/r/90b89c62-07b7-4a91-9d7f-609c59bf50ca

  • Function ssh2_forward_accept invoked with 1 parameter, 0 required. => ssh2_forward_accept require 1 param
  • Function ssh2_forward_listen invoked with 2 parameters, 0 required. => 2 param should be required
  • ssh2_forward_accept, ssh2_forward_listen and ssh2_poll are returning mixed for phpstan when it should be resource|false
  • ssh2_poll are returning mixed for phpstan when it should be int

I opened the PR on phpstorm to fix this JetBrains/phpstorm-stubs#1758

But I'm not sure to understand how phpstan works. I thought

  • It used phpstorm-stubs on PHP 8+
  • It use the functionMap on PHP 7.4-

So I opened the PR to fix this on PHP 7.4- ; but it seems like the phpstorm-stubs are also already used on Php 7.4- (?)

@ondrejmirtes
Copy link
Member

phpstorm-stubs is always used.

php-8-stubs is only used on PHP 8+ (hence the name).

When an error message says "Function ssh2_forward_accept invoked with 1 parameter, 0 required.", it means PHPStan knows the function, but it has wrong signature. Therefore diff ADDING an entry to functionMap.php is suspicious.

I'd prefer waiting for phpstorm-stubs fix to be merged.

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