Skip to content

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

Merged
soyuka merged 1 commit into
api-platform:3.0from
chalasr:generic-obj-provider
Oct 6, 2022
Merged

fix(state): improve DX around the generic ObjectProvider#5051
soyuka merged 1 commit into
api-platform:3.0from
chalasr:generic-obj-provider

Conversation

@chalasr

@chalasr chalasr commented Oct 5, 2022

Copy link
Copy Markdown
Contributor
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

soyuka commented Oct 6, 2022

Copy link
Copy Markdown
Member

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