-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: TypeError
in DataCaster
initialization
#9738
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
base: develop
Are you sure you want to change the base?
Conversation
The two checks conflict. What is the best way to fix it? |
Do you think this exception is necessary? The PHPDoc already makes it clear. |
phpDoc will not help if the user uses a different method (in notepad++). |
I'm afraid I don't fully understand what you mean. Since this isn't directly used by the end user, I'd stick with the PHPDoc. It has worked fine so far - unless there's a specific reason for adding this check? |
Sorry. Typo "translation". |
This exception was previously used in the entity cast. Let's hold off for now and hear what others think. If you feel it's more valuable to keep the exception and make the PHPDoc less strict, that's fine too. |
c3d4e15
to
cb3d4bf
Compare
DataCaster
initializationTypeError
in DataCaster
initialization
* Convert handlers. | ||
* | ||
* @var array<string, class-string> [type => classname] | ||
* @var array<string, class-string> [type => classname] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this also have the CastInterface
and EnityCastInterface
as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we've decided on separate typing, I'm unsure about specifying the types...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now wondering if the framework should be the one adjusting for this missing support of phpDocumentor. I feel we are being redundant in our PHPDocs just because our API tool does not yet support a feature that is widely used now. Should this be a feature request to them (to support phpstan types and conditional returns?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an alternative to phpDocumentor that would handle it better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a small project, I would ignore the duplication and rely on the phpstan. types.
Looking at symfony, they don't bother with this.
There is a slightly different option, which is more complex - to use a Value Object, DTO instead of an array.
Description
new DataCaster()
caused the errorTypeError: array_merge(): Argument #2 must be of type array, null given
castAs()
and a test.BaseCast
Checklist: