• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mpyw / laravel-file-errors / 4401972525

pending completion
4401972525

push

github

mpyw
chore: 🤖 Drop stale version support

24 of 24 relevant lines covered (100.0%)

9.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/IncludesFileErrorDetails.php
1
<?php
2

3
namespace Mpyw\LaravelFileErrors;
4

5
use Illuminate\Http\UploadedFile;
6

7
/**
8
 * Class IncludesFileErrorDetails
9
 *
10
 * @mixin \Illuminate\Validation\Validator
11
 */
12
trait IncludesFileErrorDetails
13
{
14
    /**
15
     * Add a failed rule and error message to the collection.
16
     *
17
     * @param string $attribute
18
     * @param string $rule
19
     * @param array  $parameters
20
     */
21
    public function addFailure($attribute, $rule, $parameters = []): void
22
    {
23
        if ($rule === 'uploaded' && ($value = $this->getValue($attribute)) instanceof UploadedFile) {
6✔
24
            $rule = 'uploaded.' . UploadError::fromFile($value);
6✔
25
        }
26

27
        parent::addFailure($attribute, $rule, $parameters);
6✔
28
    }
29
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc