Skip to content

Commit bacd5dc

Browse files
committed
Use compatible rule
1 parent 06721df commit bacd5dc

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

tests/Stubs/TestRules/Uppercase.php

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,39 @@
22

33
namespace Rakutentech\LaravelRequestDocs\Tests\Stubs\TestRules;
44

5-
use Illuminate\Contracts\Validation\InvokableRule;
5+
use Illuminate\Contracts\Validation\Rule;
66

7-
class Uppercase implements InvokableRule
7+
class Uppercase implements Rule
88
{
99
/**
10-
* Run the validation rule.
10+
* Create a new rule instance.
11+
*
12+
* @return void
13+
*/
14+
public function __construct()
15+
{
16+
//
17+
}
18+
19+
/**
20+
* Determine if the validation rule passes.
1121
*
1222
* @param string $attribute
1323
* @param mixed $value
14-
* @param \Closure $fail
15-
* @return void
24+
* @return bool
25+
*/
26+
public function passes($attribute, $value)
27+
{
28+
return strtoupper($value) === $value;
29+
}
30+
31+
/**
32+
* Get the validation error message.
33+
*
34+
* @return string
1635
*/
17-
public function __invoke($attribute, $value, $fail)
36+
public function message()
1837
{
19-
if (strtoupper($value) !== $value) {
20-
$fail('The :attribute must be uppercase.');
21-
}
38+
return 'The :attribute must be uppercase.';
2239
}
2340
}

0 commit comments

Comments
 (0)