Convert string validation rules into arrays for Laravel's Validator.
Validator::make($data, [
- 'field' => 'required|nullable|string|max:255',
+ 'field' => ['required', 'nullable', 'string', 'max:255'],
]);
Configure your rector.php
:
<?php
use RectorLaravel\Rector\MethodCall\ValidationRuleArrayStringValueToArrayRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
ValidationRuleArrayStringValueToArrayRector::class,
]);