1 | <?php |
||||
2 | |||||
3 | namespace Belamov\PostgresRange\Macros; |
||||
4 | |||||
5 | use Illuminate\Database\Schema\Blueprint; |
||||
6 | |||||
7 | class BluePrintMacros |
||||
8 | { |
||||
9 | private array $columnTypes = [ |
||||
10 | ['dateRange', 'daterange'], |
||||
11 | ['timestampRange', 'tsrange'], |
||||
12 | ['timestampTzRange', 'tstzrange'], |
||||
13 | ['floatRange', 'numrange'], |
||||
14 | ['integerRange', 'int4range'], |
||||
15 | ['bigIntegerRange', 'int8range'], |
||||
16 | ['timeRange', 'timerange'], |
||||
17 | ]; |
||||
18 | |||||
19 | public function register(): void |
||||
20 | { |
||||
21 | foreach ($this->columnTypes as [$columnTypeForMacro, $columnTypeForPostgres]) { |
||||
22 | Blueprint::macro( |
||||
23 | $columnTypeForMacro, |
||||
24 | fn (string $columnName) => $this->addColumn($columnTypeForPostgres, $columnName) |
||||
0 ignored issues
–
show
|
|||||
25 | ); |
||||
26 | } |
||||
27 | |||||
28 | Blueprint::macro('excludeRangeOverlapping', function ($columnName, ...$additionalColumns) { |
||||
29 | return $this->addCommand('excludeRangeOverlapping', [ |
||||
0 ignored issues
–
show
The method
addCommand() does not exist on Belamov\PostgresRange\Macros\BluePrintMacros .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||
30 | 'range_column' => $columnName, |
||||
31 | 'additionalColumns' => $additionalColumns, |
||||
32 | ]); |
||||
33 | }); |
||||
34 | } |
||||
35 | } |
||||
36 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.