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

goto seems to be unsupported #11327

Closed
Nek- opened this issue Feb 20, 2025 · 3 comments
Closed

goto seems to be unsupported #11327

Nek- opened this issue Feb 20, 2025 · 3 comments

Comments

@Nek-
Copy link

Nek- commented Feb 20, 2025

I found at least one issue: https://psalm.dev/r/3053e95e1d

However it's hard to reproduce others... But the related code is here https://github.com/amphp/http-client/blob/a3e8711cb71fe909c1ae17450bfa5db652559c20/src/Connection/Internal/Http1Parser.php#L97

ERROR: InvalidReturnType
at /Users/maxim/Dev/PhpLibs/http-client/src/Connection/Internal/Http1Parser.php:97:50
Not all code paths of Amp\Http\Client\Connection\Internal\Http1Parser::parse end in a return statement, return type Amp\Http\Client\Response|null expected (see https://psalm.dev/011)
    public function parse(?string $data = null): ?Response
Copy link

I found these snippets:

https://psalm.dev/r/3053e95e1d
<?php

function a(): int
{
    $i = 0;
    something:
    	$i++;
    
    if ($i <= 3) {
        goto something;
    }
    
    return $i;
}
Psalm output (using commit 7ee9192):

ERROR: RedundantCondition - 9:9 - Type 1 for $i is never >= 3

Nek- added a commit to Nek-/http-client that referenced this issue Feb 20, 2025
PSAML has problems with goto analyze. It leads to wrong issues:
vimeo/psalm#11327
Nek- added a commit to Nek-/http-client that referenced this issue Feb 20, 2025
Fix psalm config

PSAML has problems with goto analyze. It leads to wrong issues:
vimeo/psalm#11327
Nek- added a commit to Nek-/http-client that referenced this issue Feb 20, 2025
Fix psalm config

PSAML has problems with goto analyze. It leads to wrong issues:
vimeo/psalm#11327
@danog
Copy link
Collaborator

danog commented Feb 21, 2025

This is almost impossible to implement while handling all edge cases, won't fix.

@danog danog closed this as completed Feb 21, 2025
@s6mon
Copy link

s6mon commented Feb 21, 2025

😲

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

No branches or pull requests

3 participants