style(supplier-import): pint + larastan source fixes (убраны избыточные array_values)

Pint formatting (fully_qualified_strict_types и др.) + устранены 2 источниковых
arrayValues.list (parseGibddRegions / buildPlan return — аргумент уже list).
Production-код larastan-чист; test-only TestCall/Mockery (квирк #25) — baseline
на чистом checkout при интеграции.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Дмитрий
2026-05-22 09:58:52 +03:00
parent af0da1f98a
commit 769eb35c0a
4 changed files with 10 additions and 9 deletions
@@ -42,7 +42,7 @@ final class SupplierImportMapper
return [];
}
return array_values(array_map(static fn (string $p): int => (int) $p, $parts));
return array_map(static fn (string $p): int => (int) $p, $parts);
}
/**
@@ -141,7 +141,7 @@ class SupplierProjectImporter
$planned[] = $g;
}
return ['planned' => array_values($planned), 'skipped' => $skipped];
return ['planned' => $planned, 'skipped' => $skipped];
}
/**
@@ -277,7 +277,7 @@ class SupplierProjectImporter
*/
private function projectExists(int $tenantId, array $group): bool
{
$query = \App\Models\Project::on('pgsql_supplier')
$query = Project::on('pgsql_supplier')
->where('tenant_id', $tenantId)
->where('signal_type', $group['signal_type']);
@@ -3,8 +3,9 @@
declare(strict_types=1);
use App\Services\Supplier\Import\SupplierImportMapper;
use Tests\TestCase;
uses(Tests\TestCase::class);
uses(TestCase::class);
test('platformFromSrc maps rt/bl/mt to B1/B2/B3, others null', function (): void {
expect(SupplierImportMapper::platformFromSrc('rt'))->toBe('B1');
@@ -50,20 +50,20 @@ it('every map entry points to a distinct supplier code (no collisions)', functio
test('mapFromSupplier inverts LIDERRA_TO_SUPPLIER bijection', function (): void {
// ГИБДД 24 → Лидерра 29 (Красноярский); ГИБДД 77 → Лидерра 82 (Москва)
expect(\App\Support\SupplierRegions::mapFromSupplier([24]))->toBe([29]);
expect(\App\Support\SupplierRegions::mapFromSupplier([77]))->toBe([82]);
expect(SupplierRegions::mapFromSupplier([24]))->toBe([29]);
expect(SupplierRegions::mapFromSupplier([77]))->toBe([82]);
});
test('mapFromSupplier maps multiple codes, sorted ascending, deduped', function (): void {
// ГИБДД 77→82 (Москва), 78→83 (СПб), 24→29 (Красноярский)
expect(\App\Support\SupplierRegions::mapFromSupplier([78, 24, 77, 24]))->toBe([29, 82, 83]);
expect(SupplierRegions::mapFromSupplier([78, 24, 77, 24]))->toBe([29, 82, 83]);
});
test('mapFromSupplier drops unknown supplier codes', function (): void {
// 999 нет в карте → отброшен; 24 → 29
expect(\App\Support\SupplierRegions::mapFromSupplier([999, 24]))->toBe([29]);
expect(SupplierRegions::mapFromSupplier([999, 24]))->toBe([29]);
});
test('mapFromSupplier returns [] for empty input', function (): void {
expect(\App\Support\SupplierRegions::mapFromSupplier([]))->toBe([]);
expect(SupplierRegions::mapFromSupplier([]))->toBe([]);
});