From 769eb35c0a65d39a94530dc0eeef774bcb856f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Fri, 22 May 2026 09:58:52 +0300 Subject: [PATCH] =?UTF-8?q?style(supplier-import):=20pint=20+=20larastan?= =?UTF-8?q?=20source=20fixes=20(=D1=83=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=B1=D1=8B=D1=82=D0=BE=D1=87=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?array=5Fvalues)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../Services/Supplier/Import/SupplierImportMapper.php | 2 +- .../Supplier/Import/SupplierProjectImporter.php | 4 ++-- app/tests/Unit/Supplier/SupplierImportMapperTest.php | 3 ++- app/tests/Unit/Supplier/SupplierRegionsTest.php | 10 +++++----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/app/Services/Supplier/Import/SupplierImportMapper.php b/app/app/Services/Supplier/Import/SupplierImportMapper.php index 62811639..ebac2aaf 100644 --- a/app/app/Services/Supplier/Import/SupplierImportMapper.php +++ b/app/app/Services/Supplier/Import/SupplierImportMapper.php @@ -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); } /** diff --git a/app/app/Services/Supplier/Import/SupplierProjectImporter.php b/app/app/Services/Supplier/Import/SupplierProjectImporter.php index 2b7bb1c9..79083581 100644 --- a/app/app/Services/Supplier/Import/SupplierProjectImporter.php +++ b/app/app/Services/Supplier/Import/SupplierProjectImporter.php @@ -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']); diff --git a/app/tests/Unit/Supplier/SupplierImportMapperTest.php b/app/tests/Unit/Supplier/SupplierImportMapperTest.php index d8eeb018..f6977cf4 100644 --- a/app/tests/Unit/Supplier/SupplierImportMapperTest.php +++ b/app/tests/Unit/Supplier/SupplierImportMapperTest.php @@ -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'); diff --git a/app/tests/Unit/Supplier/SupplierRegionsTest.php b/app/tests/Unit/Supplier/SupplierRegionsTest.php index ba04c5a6..0cb601b2 100644 --- a/app/tests/Unit/Supplier/SupplierRegionsTest.php +++ b/app/tests/Unit/Supplier/SupplierRegionsTest.php @@ -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([]); });