Skip to content

Commit 06ab080

Browse files
committed
refactor(schema): Reduce the API surface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent ffb57f5 commit 06ab080

4 files changed

Lines changed: 20 additions & 89 deletions

File tree

lib/private/DB/Schema/Index.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,41 +53,6 @@ public function isSimpleIndex(): bool {
5353
return $this->index->isSimpleIndex();
5454
}
5555

56-
#[\Override]
57-
public function spansColumns(array $columnNames): bool {
58-
return $this->index->spansColumns($columnNames);
59-
}
60-
61-
#[\Override]
62-
public function hasColumnAtPosition(string $name, int $pos = 0): bool {
63-
return $this->index->hasColumnAtPosition($name, $pos);
64-
}
65-
66-
#[\Override]
67-
public function getFlags(): array {
68-
return array_values($this->index->getFlags());
69-
}
70-
71-
#[\Override]
72-
public function hasFlag(string $flag): bool {
73-
return $this->index->hasFlag($flag);
74-
}
75-
76-
#[\Override]
77-
public function hasOption(string $name): bool {
78-
return $this->index->hasOption($name);
79-
}
80-
81-
#[\Override]
82-
public function getOption(string $name): mixed {
83-
return $this->index->getOption($name);
84-
}
85-
86-
#[\Override]
87-
public function getOptions(): array {
88-
return $this->index->getOptions();
89-
}
90-
9156
/**
9257
* Forwards any method not declared on IIndex to the wrapped Doctrine
9358
* DBAL index, e.g. mutators like `addFlag()` or `removeFlag()` that are

lib/public/DB/Schema/IIndex.php

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -53,56 +53,4 @@ public function isPrimary(): bool;
5353
* @since 35.0.0
5454
*/
5555
public function isSimpleIndex(): bool;
56-
57-
/**
58-
* Checks if this index exactly spans the given column names in the correct order.
59-
*
60-
* @param list<string> $columnNames
61-
* @since 35.0.0
62-
*/
63-
public function spansColumns(array $columnNames): bool;
64-
65-
/**
66-
* Checks whether the given column is at the given position within this index.
67-
*
68-
* @since 35.0.0
69-
*/
70-
public function hasColumnAtPosition(string $name, int $pos = 0): bool;
71-
72-
/**
73-
* Returns the platform specific flags for this index.
74-
*
75-
* @return list<string>
76-
* @since 35.0.0
77-
*/
78-
public function getFlags(): array;
79-
80-
/**
81-
* Returns whether this index has the given platform specific flag.
82-
*
83-
* @since 35.0.0
84-
*/
85-
public function hasFlag(string $flag): bool;
86-
87-
/**
88-
* Returns whether this index has the given platform specific option.
89-
*
90-
* @since 35.0.0
91-
*/
92-
public function hasOption(string $name): bool;
93-
94-
/**
95-
* Returns the given platform specific option.
96-
*
97-
* @since 35.0.0
98-
*/
99-
public function getOption(string $name): mixed;
100-
101-
/**
102-
* Returns all platform specific options.
103-
*
104-
* @return array<string, mixed>
105-
* @since 35.0.0
106-
*/
107-
public function getOptions(): array;
10856
}

lib/public/DB/Schema/ITable.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,14 @@ public function renameIndex(string $oldName, ?string $newName = null): self;
120120
/**
121121
* @param string $name
122122
* @param string $typeName
123-
* @param array<string, mixed> $options
123+
* @param array{
124+
* notnull?: bool,
125+
* length?: ?int,
126+
* default?: ?scalar,
127+
* unsigned?: bool,
128+
* autoincrement?: bool,
129+
* fixed?: bool,
130+
* } $options
124131
*
125132
* @throws SchemaException
126133
* @since 35.0.0
@@ -129,7 +136,14 @@ public function addColumn(string $name, string $typeName, array $options = []):
129136

130137
/**
131138
* @param string $name
132-
* @param array<string, mixed> $options
139+
* @param array{
140+
* notnull?: bool,
141+
* length?: ?int,
142+
* default?: ?scalar,
143+
* unsigned?: bool,
144+
* autoincrement?: bool,
145+
* fixed?: bool,
146+
* } $options
133147
*
134148
* @throws SchemaException
135149
* @since 35.0.0

lib/public/DB/Schema/IType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace OCP\DB\Schema;
1111

12+
use OCP\DB\Types;
13+
1214
/**
1315
* Object representation of a column type.
1416
*
@@ -18,6 +20,8 @@ interface IType {
1820
/**
1921
* Returns the name of this type.
2022
*
23+
* @return Types::*
24+
*
2125
* @since 35.0.0
2226
*/
2327
public function getName(): string;

0 commit comments

Comments
 (0)