Skip to content

Commit bab1c17

Browse files
committed
rename migration file / update handleColumnPersistDbException return type / use attributes instead of doc annotation
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
1 parent d54e6fe commit bab1c17

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

lib/Migration/Version1000Date20260327000000.php renamed to lib/Migration/Version2200Date20260707000000.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use OCP\Migration\SimpleMigrationStep;
1919
use Override;
2020

21-
class Version1000Date20260327000000 extends SimpleMigrationStep {
21+
class Version2200Date20260707000000 extends SimpleMigrationStep {
2222
private IDBConnection $connection;
2323

2424
public function __construct(IDBConnection $connection) {
@@ -79,6 +79,6 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
7979
$result->closeCursor();
8080
}
8181

82-
$output->info('Version1000Date20260327000000: backfilled technical_name for ' . $updatedCount . ' columns.');
82+
$output->info('Version2200Date20260707000000: backfilled technical_name for ' . $updatedCount . ' columns.');
8383
}
8484
}

lib/Service/ColumnService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ private function buildDefaultTechnicalName(int $columnId): string {
746746
* @throws BadRequestError
747747
* @throws InternalError
748748
*/
749-
private function handleColumnPersistDbException(\OCP\DB\Exception $e, string $context): void {
749+
private function handleColumnPersistDbException(\OCP\DB\Exception $e, string $context): never {
750750
if ($e->getReason() === \OCP\DB\Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
751751
throw new BadRequestError('Technical name must be unique in the table.');
752752
}

tests/unit/Validation/ColumnDtoValidatorTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OCA\Tables\Dto\Column as ColumnDto;
1313
use OCA\Tables\Errors\BadRequestError;
1414
use OCA\Tables\Validation\ColumnDtoValidator;
15+
use PHPUnit\Framework\Attributes\DataProvider;
1516
use Test\TestCase;
1617

1718
class ColumnDtoValidatorTest extends TestCase {
@@ -53,9 +54,7 @@ public function testTechnicalNameOver200CharsIsRejected(): void {
5354
$this->validator->validate($this->dto('test' . str_repeat('t', 197)));
5455
}
5556

56-
/**
57-
* @dataProvider reservedNameProvider
58-
*/
57+
#[DataProvider('reservedNameProvider')]
5958
public function testReservedTechnicalNamesAreRejected(string $name): void {
6059
$this->expectException(BadRequestError::class);
6160
$this->expectExceptionMessageMatches('/reserved/i');
@@ -73,9 +72,7 @@ public static function reservedNameProvider(): array {
7372
];
7473
}
7574

76-
/**
77-
* @dataProvider invalidFormatProvider
78-
*/
75+
#[DataProvider('invalidFormatProvider')]
7976
public function testInvalidFormatIsRejected(string $name): void {
8077
$this->expectException(BadRequestError::class);
8178
$this->expectExceptionMessageMatches('/start with a letter|lowercase|underscores/i');
@@ -93,9 +90,7 @@ public static function invalidFormatProvider(): array {
9390
];
9491
}
9592

96-
/**
97-
* @dataProvider validFormatProvider
98-
*/
93+
#[DataProvider('validFormatProvider')]
9994
public function testValidFormatIsAccepted(string $name): void {
10095
$this->expectNotToPerformAssertions();
10196
$this->validator->validate($this->dto($name));

0 commit comments

Comments
 (0)