Help with Array Wrap Cast #738
Unanswered
angel-rec-ct
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version: 3.11.2
We are working with a third party API, some of the members of the response may return and ObjectA or ObjectA[] I though I could use a property of type
public DataCollection|ObjectA $property
but that seems to throw an exceptionA data property/parameter cannot have multiple types besides the data object type (Modules\Services\DPP\Contact\Data\CreditReport\FullReport\Response\ResponseData\ResponseData::CREDIT_SCORE)
Now I'm attempting the approach of wrapping, if ObjectA comes in the property to wrap it to an array, or do nothing if an array of ObjectA is provided, I'm trying to use
WithCast
and theCast
interface to do said chore, But when I do usedd(func_get_args())
insidecast(...)
It does not execute or returns an error from Laravel.My questions are:
Any help would be appreciated, thanks for your time.
Edit: the code of the WrapArray Cast class
Beta Was this translation helpful? Give feedback.
All reactions