webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception message points to Assert code instead of app code from where it was thrown

diimpp opened this issue · comments

Sometimes assert points to correct place in the code and sometimes there are useless messages like in the example.
I've no idea what may cause this, but this is my pain for several years now and cannot even find any mention of this issue!

 [2021-06-08 15:47:02] request.CRITICAL: Uncaught PHP Exception Webmozart\Assert\InvalidArgumentException: "Expected a value other than null." at /srv/app/vendor/webmozart/assert/src/Assert.php line 2060 {"exception":"[object] (Webmozart\\Assert\\InvalidArgumentException(code: 0): Expected a value other than null. at /srv/app/vendor/webmozart/assert/src/Assert.php:2060)"} []

Mainly I'm getting this at sylius based projects.

Hello fellow countryman! I also faced this problem. I suggested a PR #241 to solve the problem. I hope it will be accepted. In the meantime, you can take a hack from PR and solve the problem through inheritance.

I had a similar issue, can an idea like this help? #266

I'm gonna close this, i don't think its worth fixing this with the complexity this introduces