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

DoclerLabs / api-client-generator / 14592925406

22 Apr 2025 10:47AM UTC coverage: 86.755% (-0.1%) from 86.862%
14592925406

push

github

web-flow
Merge pull request #124 from DoclerLabs/openapi3.1

openapi 3.1

14 of 24 new or added lines in 3 files covered. (58.33%)

2941 of 3390 relevant lines covered (86.76%)

6.17 hits per line

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

25.0
/src/Entity/Constraint/MinimumConstraint.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace DoclerLabs\ApiClientGenerator\Entity\Constraint;
6

7
use DoclerLabs\ApiClientGenerator\Ast\Builder\CodeBuilder;
8
use DoclerLabs\ApiClientGenerator\Entity\FieldType;
9
use PhpParser\Node\Expr;
10
use PhpParser\Node\Expr\Variable;
11

12
class MinimumConstraint implements ConstraintInterface
13
{
14
    public function __construct(private ?float $minimum, private bool|float|null $exclusiveMinimum, private FieldType $fieldType)
15
    {
16
        // openapi 3.1 exclusiveMinimum is no longer a boolean
17
        if (is_float($exclusiveMinimum)) {
3✔
NEW
18
            $this->minimum          = $exclusiveMinimum;
×
NEW
19
            $this->exclusiveMinimum = true;
×
20
        }
21
    }
3✔
22

23
    public function exists(): bool
24
    {
25
        return $this->minimum !== null;
2✔
26
    }
27

28
    public function getIfCondition(Variable $variable, CodeBuilder $builder): Expr
29
    {
30
        return $builder->compare(
×
31
            $variable,
32
            $this->exclusiveMinimum === true ? '<=' : '<',
×
33
            $builder->val($this->fieldType->isInteger() ? (int)$this->minimum : $this->minimum)
×
34
        );
35
    }
36

37
    public function getExceptionMessage(): string
38
    {
39
        return sprintf(
×
40
            'Cannot be less than %s%s.',
×
41
            $this->exclusiveMinimum === true ? 'or equal to ' : '',
×
42
            $this->fieldType->isInteger() ? (int)$this->minimum : $this->minimum
×
43
        );
44
    }
45
}
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