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

[Regex] Capture groups typehint #5

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

veewee
Copy link
Collaborator

@veewee veewee commented Apr 9, 2021

This PR adds better return types for Regex\capture_groups introduced in:
azjezz/psl#151

src/Plugin.php Outdated Show resolved Hide resolved
Comment on lines +51 to +53
if (!$type instanceof Type\Atomic\TLiteralInt && !$type instanceof Type\Atomic\TLiteralString) {
return self::fallbackType();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we should add an invalid argument issue here if the argument values are not literal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument is typed as list<array-key>
So it is not really a valid case I suppose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can still trigger errors from here, but not sure it's worth it.

@azjezz azjezz merged commit a9b2017 into php-standard-library:main Apr 9, 2021
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.

2 participants