Skip to content

Elide ZEND_VERIFY_RETURN_TYPE when returning $this if possible#21948

Open
Girgias wants to merge 4 commits intophp:masterfrom
Girgias:elide-return-type-check-for-this-with-static
Open

Elide ZEND_VERIFY_RETURN_TYPE when returning $this if possible#21948
Girgias wants to merge 4 commits intophp:masterfrom
Girgias:elide-return-type-check-for-this-with-static

Conversation

@Girgias
Copy link
Copy Markdown
Member

@Girgias Girgias commented May 4, 2026

Not sure if this is the most sensible approach, I would expect this to be profitable.

Maybe we can extend this to type checks of instances of the current class so that it covers self types that are resolved at compile time. Done

Maybe the test should also be more somewhere more appropriate?

@Girgias Girgias marked this pull request as ready for review May 4, 2026 20:55
@Girgias Girgias requested a review from dstogov as a code owner May 4, 2026 20:55
@Girgias Girgias requested a review from iluuu1994 May 4, 2026 20:55
@Girgias Girgias force-pushed the elide-return-type-check-for-this-with-static branch from e874ad3 to bf784bd Compare May 4, 2026 23:39
@Girgias Girgias changed the title Do not emit ZEND_VERIFY_RETURN_TYPE when returning $this with static return type Elide ZEND_VERIFY_RETURN_TYPE when returning $this if possible May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant