Skip to content

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
chriscct7 pushed a commit to awesomemotive/aioseo-slim-v3-php-8.1 that referenced this pull request Sep 3, 2025
…lock-typehinting-route-parser-interface

Improve typehinting for `RouteParserInterface`
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.

3 participants