Skip to content

Conversation

Bleksak
Copy link
Contributor

@Bleksak Bleksak commented Sep 15, 2025

This PR fixes an issue where if you want to map values into a DTO, you need to manually assert the type with assert instanceof.

This PR allows you to do $values = $form->getValues(MyFormDto::class) and the $values type will be properly typed.

@ondrejmirtes
Copy link
Member

@Bleksak Bleksak force-pushed the 2.0.x branch 2 times, most recently from 8d7bb37 to 7ebc51e Compare September 15, 2025 17:50
@Bleksak
Copy link
Contributor Author

Bleksak commented Sep 15, 2025

@ondrejmirtes Hi, thank you for your quick response. I added the test as required. I also quickly tested if getValues(true), getValues(false) still work and they both throw an exception at runtime, so I removed it from the original code.

@ondrejmirtes
Copy link
Member

Thank you for cleaning up that test! It was really old and now we know better than to mock the whole universe 😊

@ondrejmirtes ondrejmirtes merged commit 90ed4f1 into phpstan:2.0.x Sep 17, 2025
31 checks passed
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