Skip to content

Conversation

@alexchexes
Copy link

It's a pain to cast the result of \Safe\preg_replace() to string every time. This PR makes the preg_replace return type conditional on the $subject parameter type, so if you pass a string, the return type is also string.

It's a pain to cast the result of `\Safe\preg_replace()` to `string` every time. This PR makes the `preg_replace` return type conditional on the `$subject` parameter type, so if you pass a string, the return type is also `string`.
@shish
Copy link
Collaborator

shish commented Jan 5, 2026

I wonder how this interacts with https://github.com/thecodingmachine/phpstan-safe-rule which IIRC does the same thing and more 🤔

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