Propaganistas/Laravel-Phone

"mobile" parameter no longer working in 5.1.0 when one of the data fields is "mobile"

mwnciau opened this issue · 2 comments

In this commit, the mobile and fixed-line string parameters were removed from Phone::setParameters(). This breaks backwards compatibility (so should be a major release) and I don't think is intended.

Upon further investigation, I realize that the functionality is being reproduced in the type() calls at the end. The issue I'm having is that because these calls have moved to the end, $this->isDataKey($parameter) on line 161 is returning true. I'm not sure what the function of that is, but the problem ultimately is that my form data field is "mobile", which makes it think it's a country.

Reproduction:

// With data ['mobile' => '01274761999']
$request->validate(
            [
                'mobile' => ['nullable', 'phone:mobile,GB'],
            ],
        );

Continued in the linked PR