-
Notifications
You must be signed in to change notification settings - Fork 9
Annotations and migration to PHP 8.1 #101
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <files psalm-version="6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <?xml version="1.0"?> | ||
| <psalm | ||
| errorLevel="1" | ||
| resolveFromConfigFile="true" | ||
| findUnusedVariablesAndParams="false" | ||
| findUnusedCode="false" | ||
| phpVersion="8.1.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns="https://getpsalm.org/schema/config" | ||
| xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
| errorBaseline="psalm-baseline.xml" | ||
| > | ||
| <projectFiles> | ||
| <directory name="src"/> | ||
| <ignoreFiles> | ||
| <directory name="vendor"/> | ||
| </ignoreFiles> | ||
| </projectFiles> | ||
|
|
||
| <issueHandlers> | ||
| <!-- Legacy SDK: dynamic property hydration from API payloads --> | ||
| <MissingConstructor errorLevel="suppress"/> | ||
| <!-- Typed class constants (PHP 8.3+ syntax); SDK stays PHP 8.1-compatible until min is raised --> | ||
| <MissingClassConstType errorLevel="suppress"/> | ||
| <PropertyNotSetInConstructor errorLevel="suppress"/> | ||
| <UnusedClass errorLevel="suppress"/> | ||
| <PossiblyUnusedMethod errorLevel="suppress"/> | ||
| <ClassMustBeFinal errorLevel="suppress"/> | ||
| <MissingOverrideAttribute errorLevel="suppress"/> | ||
| <LessSpecificReturnType errorLevel="info"/> | ||
| <MissingClosureReturnType errorLevel="info"/> | ||
| <!-- Incremental typing: keep CI green while improving annotations over time --> | ||
| <MissingPropertyType errorLevel="info"/> | ||
| <MissingParamType errorLevel="info"/> | ||
| <MissingReturnType errorLevel="info"/> | ||
| <MixedArgument errorLevel="info"/> | ||
| <MixedAssignment errorLevel="info"/> | ||
| <MixedOperand errorLevel="info"/> | ||
| <MixedArrayAccess errorLevel="info"/> | ||
| <MixedArrayOffset errorLevel="info"/> | ||
| <MixedReturnStatement errorLevel="info"/> | ||
| <MixedPropertyFetch errorLevel="info"/> | ||
| <MixedMethodCall errorLevel="info"/> | ||
| <MixedArgumentTypeCoercion errorLevel="info"/> | ||
| <MixedPropertyTypeCoercion errorLevel="info"/> | ||
| <RiskyTruthyFalsyComparison errorLevel="info"/> | ||
| <LessSpecificReturnStatement errorLevel="info"/> | ||
| <MoreSpecificReturnType errorLevel="info"/> | ||
| <MoreSpecificImplementedParamType errorLevel="info"/> | ||
| <LessSpecificImplementedReturnType errorLevel="info"/> | ||
| <DocblockTypeContradiction errorLevel="info"/> | ||
| <ImplicitToStringCast errorLevel="info"/> | ||
| </issueHandlers> | ||
| </psalm> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In Guzzle 7, what are the declared return types ofGuzzleHttp\Client::request()andGuzzleHttp\Exception\RequestException::getResponse()—GuzzleHttp\Psr7\ResponseorPsr\Http\Message\ResponseInterface?💡 Result:
In Guzzle 7, the declared return type of GuzzleHttp\Client::request is Psr\Http\Message\ResponseInterface [1][2]. The declared return type of GuzzleHttp\Exception\RequestException::getResponse is?Psr\Http\Message\ResponseInterface (nullable ResponseInterface) [3]. Guzzle uses PSR-7 interfaces throughout, not its concrete Psr7 classes in method signatures [4][5][6].
Citations:
🏁 Script executed:
Repository: Penneo/sdk-php
Length of output: 1940
🏁 Script executed:
Repository: Penneo/sdk-php
Length of output: 1382
🏁 Script executed:
rg "interface ResponseInterface" --type php -A 20Repository: Penneo/sdk-php
Length of output: 40
🌐 Web query:
Does PSR-7 ResponseInterface have getHeader() method? What methods are in ResponseInterface?💡 Result:
Yes. PSR-7 ResponseInterface (Psr\Http\Message\ResponseInterface) has getHeader($name) method (inherited from MessageInterface) [1][2]. Methods in Psr\Http\Message\ResponseInterface - From MessageInterface: - getProtocolVersion [1][2] - withProtocolVersion($version) [2][1] - getHeaders [3][4] - hasHeader($name) [1][2] - getHeader($name): array [1][2] - getHeaderLine($name): string [2][1] - withHeader($name, $value) [2] - withAddedHeader($name, $value) [3][4] - withoutHeader($name) [3][4] - getBody [4] - withBody(StreamInterface $body) [4] - Response-specific: - getStatusCode [3][4] - withStatus($code, $reasonPhrase = '') [3][4] - getReasonPhrase [3][4]
Citations:
🏁 Script executed:
rg "Response" src/ApiConnector.phpRepository: Penneo/sdk-php
Length of output: 199
Return
ResponseInterface, not the concrete Guzzle response class.Client::request()is typed against PSR-7ResponseInterface. NarrowingcallServer()to?Responsehard-codes the implementation class and can trip a runtimeTypeErrorif a different PSR-7 response object comes back through the handler stack. Theinstanceof Responsecheck on line 189 is also unnecessary—ResponseInterfaceincludes thegetHeader()method.Suggested fix
Also applies to: 189-197
🤖 Prompt for AI Agents