From 4c6d48eeac61ea8b7c23bb9a7ea4716e48360219 Mon Sep 17 00:00:00 2001 From: agis Date: Tue, 15 Sep 2026 14:54:47 +0700 Subject: [PATCH 1/2] refactor(config): drop Repository::getEnvironment() (task 2.7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove getEnvironment(); the only fork-internal caller (the package afterLoading closure) now reads $me->environment directly. Loader/cascade/ ctor unchanged (minimal scope — evaporates at Wave 4 swap). Enforcement is runtime fatal: facade + injected callers become method-not-found. App-side conform (getEnvironment → App::environment()/app()->environment()) ships in a separate dicoding branch. Co-Authored-By: Claude --- src/Illuminate/Config/Repository.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Illuminate/Config/Repository.php b/src/Illuminate/Config/Repository.php index 3a33d3fa..d76b5368 100755 --- a/src/Illuminate/Config/Repository.php +++ b/src/Illuminate/Config/Repository.php @@ -247,7 +247,7 @@ public function package($package, $hint, $namespace = null) $this->afterLoading($namespace, function($me, $group, $items) use ($package) { - $env = $me->getEnvironment(); + $env = $me->environment; $loader = $me->getLoader(); @@ -342,16 +342,6 @@ public function setLoader(LoaderInterface $loader) $this->loader = $loader; } - /** - * Get the current configuration environment. - * - * @return string - */ - public function getEnvironment() - { - return $this->environment; - } - /** * Get the after load callback array. * From d0f946cb7b984ceef805dc613d30937806824e77 Mon Sep 17 00:00:00 2001 From: agis Date: Tue, 15 Sep 2026 16:57:20 +0700 Subject: [PATCH 2/2] =?UTF-8?q?ci(ratchet):=20drop=20config=5FgetEnvironme?= =?UTF-8?q?nt=20pattern=20=E2=80=94=20now=20type-enforced=20(task=200.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task 2.7 removed Config\Repository::getEnvironment() from the fork with no shim, so any surviving call is method-not-found (PHP+Psalm catches it). The grep-ratchet pattern is redundant with that type enforcement and, worse, false-positives on Queue\Listener::getEnvironment() — an unrelated worker method — keeping the count stuck at 1. Prune the pattern from the ratchet + baseline and move the row to a new "already type-enforced" section of the divergence ledger. First concrete slice of framework-first task 0.2 (demote ratchet to non-type patterns as components get type-tightened). Co-Authored-By: Claude Opus 4.8 (1M context) --- ci/convergence-baseline.txt | 1 - ci/convergence-ratchet.sh | 1 - docs/DIVERGENCE-LEDGER.md | 10 +++++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ci/convergence-baseline.txt b/ci/convergence-baseline.txt index f1bb9a32..b6600429 100644 --- a/ci/convergence-baseline.txt +++ b/ci/convergence-baseline.txt @@ -3,7 +3,6 @@ array_first_last=0 route_uses_string=5 event_fire=3 -config_getEnvironment=3 where_raw=1 eloquent_lists=6 macroable_trait=12 diff --git a/ci/convergence-ratchet.sh b/ci/convergence-ratchet.sh index 9f99f3a1..e903fdac 100755 --- a/ci/convergence-ratchet.sh +++ b/ci/convergence-ratchet.sh @@ -28,7 +28,6 @@ PATTERNS=( "array_first_last:::\\b(array_first|array_last)\\(" "route_uses_string:::['\"]uses['\"][[:space:]]*=>" "event_fire:::->fire\\(" - "config_getEnvironment:::getEnvironment\\(" "where_raw:::->whereRaw\\(" "eloquent_lists:::->lists\\(" "macroable_trait:::MacroableTrait" diff --git a/docs/DIVERGENCE-LEDGER.md b/docs/DIVERGENCE-LEDGER.md index 7c4b4852..c2cbc12d 100644 --- a/docs/DIVERGENCE-LEDGER.md +++ b/docs/DIVERGENCE-LEDGER.md @@ -20,7 +20,6 @@ Grandfather yang lama; blok yang **baru**. | `array_first_last` | `array_first($x)` / `array_last($x)` | `Arr::first($x)` / `Arr::last($x)` | helper global dihapus di L13 | | `route_uses_string` | `Route::get('/x', ['uses'=>'C@m'])` | `Route::get('/x', [C::class,'m'])` | valid di 4.2 **dan** 13 | | `event_fire` | `Event::fire(...)` / `->fire(...)` | `->dispatch(...)` | rename di L13; `firing()` dihapus | -| `config_getEnvironment` | `Config::getEnvironment()` | helper app `app_env()` (`config('app.env')`) | method **dihapus** di L13 (dipakai app!) | | `where_raw` | `->whereRaw("id=$id")` | binding `->where('id',$id)` / `?` | SQL injection + konvergensi | | `eloquent_lists` | `$q->lists('c')` | `$q->pluck('c')` | `->lists()` dihapus | | `macroable_trait` | `use …\MacroableTrait` | `use …\Macroable` | rename di L13 | @@ -29,6 +28,15 @@ Grandfather yang lama; blok yang **baru**. | `pagination_getters` | `->getCurrentPage()`, `->getLastPage()`, `->getFrom/To/Total/PerPage()` | `->currentPage()`, `->lastPage()`, `->firstItem/lastItem/total/perPage()` | getter di-rename massal | | `route_filters` | `Route::filter(...)`, `->before(...)`, `->after(...)` | middleware | filter **dihapus total** di L13 | +## Sudah type-enforced (dipindah dari ratchet) + +Pola yang komponen fork-nya sudah di-*tighten* (method dihapus tanpa shim) → panggilan lama = +method-not-found (PHP+Psalm menangkap). Grep-ratchet jadi redundan → dicabut (framework-first §0.2). + +| `key` (eks-ratchet) | Pola 4.2 | Konvergen ke L13 | Enforcement sekarang | +|---|---|---|---| +| `config_getEnvironment` | `Config::getEnvironment()` | `App::environment()` | task 2.7 drop `Repository::getEnvironment()` (no shim) → method-not-found | + ## Gotcha yang butuh perhatian manual (tak di-ratchet, cek saat digarap) | Isu | Aksi |