fix: `TypeError` in `DataCaster` initialization
Description
- Fixed a bug where
new DataCaster()caused the errorTypeError: array_merge(): Argument #2 must be of type array, null given - Added a method check for
castAs()and a test. - PHPDoc has been cleaned in
BaseCast
Checklist:
- [x] Securely signed commits
- [x] Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
- [x] Unit testing, with >80% coverage
- [ ] User guide updated
- [x] Conforms to style guide
The two checks conflict. What is the best way to fix it? Update PHPDoc, add ignore, or remove exception?
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++). Secondly, I've been thinking about it too. Then we can remove the exception and translation.
Then we can remove the exception and transfer.
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". Yes, it works. Then we have the dead code in the CastException. I decided that the check is necessary if an exception is planned. Or delete exception method.
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.
Thank you, @neznaika0