cviebrock/image-validator

Argument 4 passed to Cviebrock\ImageValidator\ImageValidator::__construct() must be of the type array

Closed this issue · 2 comments

Hello,

I've been getting this error since a recent update.

Type error: Argument 4 passed to Cviebrock\ImageValidator\ImageValidator::__construct() must be of the type array, string given, called in /home/vagrant/monitoring-assistance/vendor/cviebrock/image-validator/src/ImageValidatorServiceProvider.php on line 34

This error is fixed by not type hinting for an array as the forth argument. This issue from what I could debug is that the translations aren't loaded, and thus the key is sent to the constructor.

Update:

When running dd(trans('image-validator::validation')); in the ImageValidatorServiceProvider right before the this->app->bind, it finds the validation keys (array).

However, when running the same dd() function inside the bind closure, it doesn't find the validation keys.

For me this is not solving the problem. I use the version 2.4 with L5.1 and the dd() of trans('image-validator::validation') outside the app bind returns a string.

I think it's because of my locales: I use it_IT, en_GB etc. and not "it".

EDIT: Solved overwriting the package locales (creating a folder in /resources/lang/vendor/image-validator/it_IT and so on)