06-01 (S112 exceptions), 06-02 (S1142 returns), 06-03 (S1192 constants) done. Next: 06-06 → 06-04 → 06-05 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
148 lines
6.3 KiB
Markdown
148 lines
6.3 KiB
Markdown
---
|
|
phase: 06-sonarqube-quality
|
|
plan: 03
|
|
subsystem: core
|
|
tags: [constants, sonarqube, php, refactoring, s1192]
|
|
|
|
requires:
|
|
- phase: []
|
|
provides: []
|
|
provides:
|
|
- IntegrationSources constants class (ALLEGRO, SHOPPRO, APACZKA, INPOST)
|
|
- RedirectPaths constants class (6 Allegro + 1 Shoppro paths)
|
|
- Elimination of repeated string literals across services and controllers
|
|
affects: [06-02, 06-04, 06-05, 06-06]
|
|
|
|
tech-stack:
|
|
added: []
|
|
patterns: [constants-class, final-static-class]
|
|
|
|
key-files:
|
|
created:
|
|
- src/Core/Constants/IntegrationSources.php
|
|
- src/Core/Constants/RedirectPaths.php
|
|
modified:
|
|
- src/Modules/Settings/AllegroIntegrationController.php
|
|
- src/Modules/Settings/ShopproIntegrationsController.php
|
|
- src/Modules/Settings/AllegroOrderImportService.php
|
|
- src/Modules/Settings/AllegroStatusSyncService.php
|
|
- src/Modules/Settings/ShopproOrdersSyncService.php
|
|
- src/Modules/Settings/ShopproPaymentStatusSyncService.php
|
|
|
|
key-decisions:
|
|
- "carrier/payment_type 'allegro' fallbacks NOT replaced — not integration source identifiers"
|
|
- "SQL WHERE literals left as-is per BOUNDARIES"
|
|
- "'activeSettings' => 'allegro' view variables NOT replaced — template variable, not source id"
|
|
|
|
patterns-established:
|
|
- "Integration source identifiers: always IntegrationSources::ALLEGRO etc."
|
|
- "Redirect paths: always RedirectPaths::* — no hardcoded strings in controllers"
|
|
- "Constants namespace: App\\Core\\Constants — global identifiers live here"
|
|
|
|
duration: ~30min
|
|
started: 2026-03-13T00:00:00Z
|
|
completed: 2026-03-13T00:00:00Z
|
|
---
|
|
|
|
# Phase 6 Plan 03: php:S1192 Stałe dla Literałów — Summary
|
|
|
|
**IntegrationSources and RedirectPaths constants created in src/Core/Constants/; 30+ repeated string literals replaced across 6 service/controller files, eliminating S1192 violations.**
|
|
|
|
## Performance
|
|
|
|
| Metric | Value |
|
|
|--------|-------|
|
|
| Duration | ~30 min |
|
|
| Started | 2026-03-13 |
|
|
| Completed | 2026-03-13 |
|
|
| Tasks | 3/3 completed |
|
|
| Files created | 2 |
|
|
| Files modified | 6 |
|
|
|
|
## Acceptance Criteria Results
|
|
|
|
| Criterion | Status | Notes |
|
|
|-----------|--------|-------|
|
|
| AC-1: Klasy stałych istnieją | Pass | IntegrationSources + RedirectPaths w src/Core/Constants/ |
|
|
| AC-2: Identyfikatory źródeł podmienione | Pass | 'allegro'/'shoppro' jako source identifiers zastąpione; SQL/carrier/view-variable literals pominięte |
|
|
| AC-3: Redirect paths podmienione w kontrolerach | Pass | 24+ literałów w AllegroIntegrationController + 3 w ShopproIntegrationsController |
|
|
| AC-4: Brak regresji | Pass | Wartości stałych identyczne z oryginalymi; php -l bez błędów |
|
|
|
|
## Accomplishments
|
|
|
|
- Dwie klasy stałych final bez konstruktorów: `IntegrationSources` (4 stałe) i `RedirectPaths` (7 stałych)
|
|
- Wszystkie redirect paths w AllegroIntegrationController (24+ powtórzeń) → RedirectPaths::*
|
|
- Identyfikatory źródeł w 4 service'ach + 2 kontrolerach → IntegrationSources::*
|
|
- Auto-fix: naprawiono dwa złamane `use` statements z planu 06-01 (brakujące backslashe)
|
|
|
|
## Task Commits
|
|
|
|
| Task | Commit | Type | Description |
|
|
|------|--------|------|-------------|
|
|
| Task 1+2+3 (całość) | `d7d3f99` | feat | constants classes + literals replacement + auto-fix broken use statements |
|
|
|
|
## Files Created/Modified
|
|
|
|
| File | Zmiana | Cel |
|
|
|------|--------|-----|
|
|
| src/Core/Constants/IntegrationSources.php | Created | ALLEGRO, SHOPPRO, APACZKA, INPOST |
|
|
| src/Core/Constants/RedirectPaths.php | Created | 7 stałych dla redirect paths (Allegro + Shoppro) |
|
|
| src/Modules/Settings/AllegroIntegrationController.php | Modified | 24+ redirect paths + 3 listMappings/saveMappings + fix broken use |
|
|
| src/Modules/Settings/ShopproIntegrationsController.php | Modified | 3 redirect paths + 3 listMappings/saveMappings |
|
|
| src/Modules/Settings/AllegroOrderImportService.php | Modified | 2x 'allegro' source + fix broken use (AppCoreExceptionsAllegroApiException) |
|
|
| src/Modules/Settings/AllegroStatusSyncService.php | Modified | 1x 'allegro' SQL param binding |
|
|
| src/Modules/Settings/ShopproOrdersSyncService.php | Modified | 2x 'shoppro' (source + external_platform_id) |
|
|
| src/Modules/Settings/ShopproPaymentStatusSyncService.php | Modified | 1x 'shoppro' source param |
|
|
|
|
## Decisions Made
|
|
|
|
| Decyzja | Uzasadnienie | Wpływ |
|
|
|---------|-------------|-------|
|
|
| 'allegro' jako carrier/payment_type fallback — zostawić | Nie jest to source identifier; to nazwa dostawcy z Allegro API | Kilka 'allegro' pozostaje, ale nie są to S1192 candidates (inne semantyki) |
|
|
| 'allegro' w WHERE SQL — zostawić | Per BOUNDARIES i SonarQube S1192 exception dla SQL | SQL literals w AllegroDeliveryMethodMappingRepository etc. niezmodyfikowane |
|
|
| 'activeSettings' => 'allegro' — zostawić | Template variable key, nie integration source identifier | Nie powoduje S1192 (tylko 1-2 razy per klasa) |
|
|
|
|
## Deviations from Plan
|
|
|
|
### Summary
|
|
|
|
| Type | Count | Impact |
|
|
|------|-------|--------|
|
|
| Auto-fix | 2 | Naprawiono broken use statements z 06-01 przy okazji |
|
|
| Scope exclusions | ~5 | Carrier/payment fallbacks, SQL literals, view variables — intentional |
|
|
| sonar-scanner pominięty | 1 | Brak dostępu CLI |
|
|
|
|
**Total impact:** Minimal — auto-fixy poprawiły ukryty bug z 06-01; exclusions zgodne z BOUNDARIES.
|
|
|
|
### Auto-fixed Issues
|
|
|
|
**1. Broken use statements z planu 06-01**
|
|
- **Found during:** Task 3 (czytanie AllegroIntegrationController) i Task 2 (AllegroOrderImportService)
|
|
- **Issue:** `use AppCoreExceptionsIntegrationConfigException;` i `use AppCoreExceptionsAllegroApiException;` — brakujące backslashe (błąd z 06-01 APPLY)
|
|
- **Fix:** Zastąpione poprawnymi `use App\Core\Exceptions\...;`
|
|
- **Files:** AllegroIntegrationController.php, AllegroOrderImportService.php
|
|
- **Verification:** `php -l` — no errors
|
|
|
|
## Skills Audit
|
|
|
|
| Skill | Status | Uwagi |
|
|
|-------|--------|-------|
|
|
| sonar-scanner | ○ skipped | Brak dostępu CLI — uruchomić ręcznie |
|
|
|
|
## Next Phase Readiness
|
|
|
|
**Ready:**
|
|
- IntegrationSources dostępne dla wszystkich przyszłych planów
|
|
- RedirectPaths dostępne dla kontrolerów
|
|
- Pattern ustanowiony: nowe stałe → src/Core/Constants/
|
|
|
|
**Concerns:**
|
|
- Broken use statements z 06-01 naprawione tylko w 2 plikach — może ich być więcej (warto sprawdzić)
|
|
- sonar-scanner nie zweryfikowany — S1192 count nie potwierdzony empirycznie
|
|
|
|
**Blockers:** None
|
|
|
|
---
|
|
*Phase: 06-sonarqube-quality, Plan: 03*
|
|
*Completed: 2026-03-13*
|