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

diego-ninja / granite / 16609029965

29 Jul 2025 10:42PM UTC coverage: 50.423%. First build
16609029965

Pull #5

github

web-flow
Merge 722918909 into 6a6caca51
Pull Request #5: code: adds phpstan level max, pint with per and github actions

321 of 632 new or added lines in 77 files covered. (50.79%)

1132 of 2245 relevant lines covered (50.42%)

9.88 hits per line

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

0.0
/src/Validation/Attributes/StringType.php
1
<?php
2

3
namespace Ninja\Granite\Validation\Attributes;
4

5
use Attribute;
6
use Ninja\Granite\Validation\Rules;
7

8
/**
9
 * Attribute for string type validation.
10
 */
11
#[Attribute(Attribute::TARGET_PROPERTY)]
12
readonly class StringType
13
{
14
    /**
15
     * @var string|null Custom error message
16
     */
17
    private ?string $message;
18

19
    /**
20
     * Constructor.
21
     *
22
     * @param string|null $message Custom error message
23
     */
24
    public function __construct(?string $message = null)
×
25
    {
26
        $this->message = $message;
×
27
    }
28

29
    /**
30
     * Get the validation rule.
31
     *
32
     * @return Rules\StringType
33
     */
34
    public function asRule(): Rules\StringType
×
35
    {
36
        $rule = new Rules\StringType();
×
NEW
37
        if (null !== $this->message) {
×
38
            $rule->withMessage($this->message);
×
39
        }
40

41
        return $rule;
×
42
    }
43
}
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

© 2026 Coveralls, Inc