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

ICanBoogie / ActiveRecord / 4542546258

pending completion
4542546258

push

github

Olivier Laviale
Add 'belongs_to' to the SchemaBuilder

29 of 29 new or added lines in 4 files covered. (100.0%)

1356 of 1726 relevant lines covered (78.56%)

36.14 hits per line

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

90.91
/lib/ActiveRecord/Schema/Character.php
1
<?php
2

3
namespace ICanBoogie\ActiveRecord\Schema;
4

5
use Attribute;
6
use LogicException;
7

8
#[Attribute(Attribute::TARGET_PROPERTY)]
9
class Character extends Constraints implements SchemaColumn
10
{
11
    public const MAX_SIZE = 65535;
12

13
    public static function __set_state(array $an_array): object
14
    {
15
        return new self(...$an_array);
2✔
16
    }
17

18
    /**
19
     * @param positive-int $size
20
     *     Maximum number of characters.
21
     * @param bool $fixed
22
     *     Whether `$size` is fixed instead of a maximum.
23
     *     Switch the resulting column from `VARCHAR` to `CHAR`.
24
     */
25
    public function __construct(
26
        public readonly int $size = 255,
27
        public readonly bool $fixed = false,
28
        bool $null = false,
29
        ?string $default = null,
30
        bool $unique = false,
31
        ?string $collate = null,
32
    ) {
33
        if ($fixed && $size > 256) {
123✔
34
            throw new LogicException("The maximum size for fixed character is 255, given: $size");
×
35
        }
36

37
        $size <= self::MAX_SIZE
123✔
38
            or throw new LogicException("The maximum size for fixed character is 65535, given: $size");
123✔
39

40
        parent::__construct(
123✔
41
            null: $null,
123✔
42
            default: $default,
123✔
43
            unique: $unique,
123✔
44
            collate: $collate,
123✔
45
        );
123✔
46
    }
47
}
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