Skip to content

Ref(phpstan)/upgrade to l10#20

Merged
danielgnh merged 2 commits intomainfrom
ref(phpstan)/upgrade-to-l10
Jan 23, 2026
Merged

Ref(phpstan)/upgrade to l10#20
danielgnh merged 2 commits intomainfrom
ref(phpstan)/upgrade-to-l10

Conversation

@danielgnh
Copy link
Member

This pull request focuses on improving type safety and robustness across the codebase, particularly around configuration, HTTP handling, and data encoding. The changes introduce stricter type checks, better error handling, and enhanced static analysis, which should help prevent subtle bugs and make the code easier to maintain.

Type safety and validation improvements:

  • Added explicit type checks and exception handling in the Config constructor to ensure all configuration options are of the expected type before assignment. This prevents invalid types from being silently accepted.
  • Improved type validation in Eip712Signer::encodeValue by adding checks for expected types (string for string and address, int for uint256) and throwing descriptive exceptions if the types do not match.

HTTP client and response handling:

  • Enhanced header handling in GuzzleHttpClient by ensuring headers are always arrays before merging and normalizing, and by adding type annotations for better static analysis. [1] [2] [3]
  • Improved the Response::json method to throw a custom exception if the decoded JSON is not an array, ensuring downstream code always receives the expected structure.
  • Updated the Response::header method to guarantee it returns a string or null, never an unexpected type.

Static analysis and documentation:

  • Increased the PHPStan static analysis level from 8 to 10, enforcing stricter code checks project-wide.
  • Added explicit type annotations for variables in ClobAuthenticator to improve static analysis and code clarity. [1] [2]

@danielgnh danielgnh self-assigned this Jan 23, 2026
@danielgnh danielgnh force-pushed the ref(phpstan)/upgrade-to-l10 branch from 0c494b1 to 42f82a0 Compare January 23, 2026 17:10
@danielgnh danielgnh merged commit 4d990ef into main Jan 23, 2026
5 checks passed
@danielgnh danielgnh deleted the ref(phpstan)/upgrade-to-l10 branch January 23, 2026 17:11
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.

1 participant