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

tempestphp / tempest-framework / 14346656354

08 Apr 2025 01:08PM UTC coverage: 81.323% (+0.06%) from 81.259%
14346656354

push

github

web-flow
ci: fix isolated testing

11491 of 14130 relevant lines covered (81.32%)

105.9 hits per line

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

70.0
/src/Tempest/Validation/src/Rules/IsFloat.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Validation\Rules;
6

7
use Attribute;
8
use Tempest\Validation\Rule;
9

10
#[Attribute]
11
final readonly class IsFloat implements Rule
12
{
13
    public function __construct(
3✔
14
        private bool $orNull = false,
15
    ) {}
3✔
16

17
    public function isValid(mixed $value): bool
3✔
18
    {
19
        if ($this->orNull && $value === null) {
3✔
20
            return true;
×
21
        }
22

23
        if ($value === null || $value === false || $value === '' || $value === []) {
3✔
24
            return false;
1✔
25
        }
26

27
        // @mago-expect strictness/require-identity-comparison
28
        return is_float($value) || floatval($value) == $value;
3✔
29
    }
30

31
    public function message(): string
×
32
    {
33
        return 'Value should be a float';
×
34
    }
35
}
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