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

Improve typehinting for RouteParserInterface #3133

Conversation

jerowork
Copy link
Contributor

Description

Previous typehinting (by docblock) in RouteParserInterface was not sufficient, it only defined the value of the array. However, both $data as $queryParams are arrays where the key as well as value is a string.

/**
 * @param string[] ... // < only defines the type of the value
 * @param array<string, string> ... // < defines the type of both key and value
 */

By improving the typehinting for these values, e.g. static analysis tools will recognize this instead of failing due to type mismatch.

Changes

  • Improved typehinting for $data and $queryParams in RouteParserInterface

Links

Previous typehinting (by docblock) was not sufficient, it only defined
the value of the array. However, both `$data` as `$queryParams` are arrays
where the key as well as value is a string.

By improving the typehinting for these values, e.g. static analysis tools
will recognize this.
@jerowork jerowork marked this pull request as ready for review December 31, 2021 07:59
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 303e0ed on jerowork:improvement/update-docblock-typehinting-route-parser-interface into af9c51e on slimphp:4.x.

@l0gicgate l0gicgate added this to the 4.10.0 milestone Jan 2, 2022
@l0gicgate
Copy link
Member

Thank you for this contribution!

@l0gicgate l0gicgate merged commit f5d1500 into slimphp:4.x Jan 2, 2022
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.

None yet

3 participants