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

fix(state): improve DX around the generic ObjectProvider #5051

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

chalasr
Copy link
Contributor

@chalasr chalasr commented Oct 5, 2022

Q A
Branch? 3.0
Tickets -
License MIT
Doc PR -

Follows #5039.
While using ReflectionClass::newInstanceWithoutConstructor() avoids any instantiation issue, it may lead to hard-to-debug situations in case the resource at hand has mandatory constructor parameters or if it initializes some state (basically any logic).
This patch makes sure that the constructor is called, while catching any potential instantiation error and turning it into a meaningful - developer-friendly error.

@chalasr chalasr force-pushed the generic-obj-provider branch 5 times, most recently from 6470195 to 432fee3 Compare October 5, 2022 14:02
@chalasr chalasr force-pushed the generic-obj-provider branch from 432fee3 to 20b2180 Compare October 5, 2022 14:03
@soyuka soyuka merged commit 00db2cd into api-platform:3.0 Oct 6, 2022
@soyuka
Copy link
Member

soyuka commented Oct 6, 2022

thanks, phpstan error not related.

@chalasr chalasr deleted the generic-obj-provider branch October 6, 2022 08:09
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