Remove unused dev dependencies and untrack the PHPUnit result cache #63

Closed
opened 2026-08-16 12:11:31 +02:00 by myrmidex · 3 comments
Owner

Leftovers found while surveying the repo after v0.4.0. All verified unused; none touch Laravel core behaviour.

.phpunit.result.cache is tracked despite being gitignored

The file is committed and listed in .gitignore:14. It was committed before the ignore rule existed, so git keeps tracking it and it churns on every test run.

git rm --cached .phpunit.result.cache

The .gitignore entry is already correct and needs no change.

Three unused dev dependencies

Package Why it can go
mockery/mockery No mocks anywhere in tests/. The suite uses factories and real HTTP calls.
fakerphp/faker No faker/fake() usage. TrackerFactory returns fixed values.
laravel/sail The project uses its own docker/dev/ compose and the dev-* shell helpers, not Sail.

Checked for transitive dependents: laravel/framework, ramsey/collection, livewire/livewire and others list faker and mockery, but all as require-dev, which Composer does not install transitively. laravel/sail has no dependents at all. Removing these three removes them outright.

docker/dev/podman-sail-alias.sh is unreferenced

A shell script defining docker/docker-compose aliases and a sail() function. Not sourced by shell.nix, and not mentioned in the README or CONTRIBUTING — both document the dev-* helpers instead.

Note it does not use the laravel/sail package; it wraps podman-compose directly. The two are independently unused.

Explicitly out of scope

config/mail.php, config/queue.php, config/filesystems.php and config/services.php have zero references in application code, but Laravel may resolve them internally during boot — QUEUE_CONNECTION=database and CACHE_STORE=database are both set. Removing them needs the app booted and the suite run with each one gone, the way config/auth.php was verified in #53. Not part of this ticket.

Acceptance criteria

  • .phpunit.result.cache untracked and no longer in the repository
  • mockery/mockery, fakerphp/faker and laravel/sail removed from composer.json, composer.lock updated
  • docker/dev/podman-sail-alias.sh removed
  • composer install succeeds from a clean vendor/
  • All three gates still pass: Pint, PHPStan level 7, PHPUnit
Leftovers found while surveying the repo after v0.4.0. All verified unused; none touch Laravel core behaviour. ## `.phpunit.result.cache` is tracked despite being gitignored The file is committed **and** listed in `.gitignore:14`. It was committed before the ignore rule existed, so git keeps tracking it and it churns on every test run. ``` git rm --cached .phpunit.result.cache ``` The `.gitignore` entry is already correct and needs no change. ## Three unused dev dependencies | Package | Why it can go | |---|---| | `mockery/mockery` | No mocks anywhere in `tests/`. The suite uses factories and real HTTP calls. | | `fakerphp/faker` | No `faker`/`fake()` usage. `TrackerFactory` returns fixed values. | | `laravel/sail` | The project uses its own `docker/dev/` compose and the `dev-*` shell helpers, not Sail. | **Checked for transitive dependents:** `laravel/framework`, `ramsey/collection`, `livewire/livewire` and others list `faker` and `mockery`, but all as **`require-dev`**, which Composer does not install transitively. `laravel/sail` has no dependents at all. Removing these three removes them outright. ## `docker/dev/podman-sail-alias.sh` is unreferenced A shell script defining `docker`/`docker-compose` aliases and a `sail()` function. Not sourced by `shell.nix`, and not mentioned in the README or CONTRIBUTING — both document the `dev-*` helpers instead. Note it does **not** use the `laravel/sail` package; it wraps `podman-compose` directly. The two are independently unused. ## Explicitly out of scope `config/mail.php`, `config/queue.php`, `config/filesystems.php` and `config/services.php` have zero references in application code, but Laravel may resolve them internally during boot — `QUEUE_CONNECTION=database` and `CACHE_STORE=database` are both set. Removing them needs the app booted and the suite run with each one gone, the way `config/auth.php` was verified in #53. Not part of this ticket. ## Acceptance criteria - [ ] `.phpunit.result.cache` untracked and no longer in the repository - [ ] `mockery/mockery`, `fakerphp/faker` and `laravel/sail` removed from `composer.json`, `composer.lock` updated - [ ] `docker/dev/podman-sail-alias.sh` removed - [ ] `composer install` succeeds from a clean `vendor/` - [ ] All three gates still pass: Pint, PHPStan level 7, PHPUnit
myrmidex added this to the v0.4.1 milestone 2026-08-16 12:11:31 +02:00
myrmidex added the
enhancement
label 2026-08-16 12:11:31 +02:00
myrmidex self-assigned this 2026-08-16 12:11:31 +02:00
Author
Owner

Correction: .phpunit.result.cache was never tracked

The ticket claims it is "committed and listed in .gitignore:14". That is wrong — I misread my own check when writing this.

Verified now:

git ls-files .phpunit.result.cache     -> (no output, not tracked)
git log --all -- .phpunit.result.cache -> (no output, never committed)
git check-ignore -v .phpunit.result.cache
  -> .gitignore:14:.phpunit.result.cache

It is correctly ignored and has never been in the repository. Nothing to do, and that acceptance criterion is void.

Added to scope

config/app.php:85 has 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), and .env.example sets APP_FAKER_LOCALE=en_US. Both are dead once fakerphp/faker is removed, so they go with it.

Revised acceptance criteria

  • .phpunit.result.cache untracked — never tracked; no action
  • mockery/mockery, fakerphp/faker and laravel/sail removed from composer.json, composer.lock updated
  • faker_locale removed from config/app.php; APP_FAKER_LOCALE removed from .env and .env.example
  • docker/dev/podman-sail-alias.sh removed
  • composer install succeeds from a clean vendor/
  • All three gates still pass: Pint, PHPStan level 7, PHPUnit
## Correction: `.phpunit.result.cache` was never tracked The ticket claims it is "committed **and** listed in `.gitignore:14`". That is wrong — I misread my own check when writing this. Verified now: ``` git ls-files .phpunit.result.cache -> (no output, not tracked) git log --all -- .phpunit.result.cache -> (no output, never committed) git check-ignore -v .phpunit.result.cache -> .gitignore:14:.phpunit.result.cache ``` It is correctly ignored and has never been in the repository. **Nothing to do**, and that acceptance criterion is void. ## Added to scope `config/app.php:85` has `'faker_locale' => env('APP_FAKER_LOCALE', 'en_US')`, and `.env.example` sets `APP_FAKER_LOCALE=en_US`. Both are dead once `fakerphp/faker` is removed, so they go with it. ## Revised acceptance criteria - [x] ~~`.phpunit.result.cache` untracked~~ — never tracked; no action - [ ] `mockery/mockery`, `fakerphp/faker` and `laravel/sail` removed from `composer.json`, `composer.lock` updated - [ ] `faker_locale` removed from `config/app.php`; `APP_FAKER_LOCALE` removed from `.env` and `.env.example` - [ ] `docker/dev/podman-sail-alias.sh` removed - [ ] `composer install` succeeds from a clean `vendor/` - [ ] All three gates still pass: Pint, PHPStan level 7, PHPUnit
Author
Owner

Correction: mockery/mockery cannot be removed

Removing it broke all 17 tests with Class "Mockery" not found.

Laravel's testing layer needs it. RefreshDatabase runs migrations through PendingCommand, which imports Mockery at vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:18 and calls Mockery::mock() at line 550. Every test using RefreshDatabase depends on it.

The framework declares Mockery under its own require-dev, which Composer does not install transitively — so the application has to declare it itself. That is exactly what this project was doing, correctly, before I removed it.

My reasoning was wrong. I checked whether our code referenced Mockery, found nothing, and treated that as sufficient. The coupling is inside vendor code at runtime, invisible to a grep of app/ and tests/ — and PHPStan reported 0 errors throughout, so static analysis could not see it either. Only running the suite caught it.

Restored via composer require --dev mockery/mockery:^1.6.

fakerphp/faker — verified removable, properly this time

Factory::withFaker() (Factory.php:1061) guards with class_exists(Generator::class) and returns null when Faker is absent. TrackerFactory uses fixed values and never touches $this->faker, so factories work without it.

Consistent with the failure output: all 17 errors named Mockery, none named Faker.

laravel/sail — removable

No dependents in composer.lock. docker/dev/podman-sail-alias.sh wraps podman-compose directly and does not use the package; both are independently unused.

Final scope

Removed: fakerphp/faker, laravel/sail, docker/dev/podman-sail-alias.sh, faker_locale from config/app.php, APP_FAKER_LOCALE from .env and .env.example.

Kept: mockery/mockery — required by the framework's testing layer.

No action: .phpunit.result.cache was never tracked.

Lesson

"Not referenced in our code" is not evidence a dependency is unused. Framework internals can require a package the application never names. The check that mattered was running the suite with it gone.

## Correction: `mockery/mockery` cannot be removed Removing it broke **all 17 tests** with `Class "Mockery" not found`. Laravel's testing layer needs it. `RefreshDatabase` runs migrations through `PendingCommand`, which imports Mockery at `vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:18` and calls `Mockery::mock()` at line 550. Every test using `RefreshDatabase` depends on it. The framework declares Mockery under its own `require-dev`, which Composer does not install transitively — so the application has to declare it itself. That is exactly what this project was doing, correctly, before I removed it. **My reasoning was wrong.** I checked whether *our* code referenced Mockery, found nothing, and treated that as sufficient. The coupling is inside vendor code at runtime, invisible to a grep of `app/` and `tests/` — and PHPStan reported 0 errors throughout, so static analysis could not see it either. Only running the suite caught it. Restored via `composer require --dev mockery/mockery:^1.6`. ## `fakerphp/faker` — verified removable, properly this time `Factory::withFaker()` (`Factory.php:1061`) guards with `class_exists(Generator::class)` and returns null when Faker is absent. `TrackerFactory` uses fixed values and never touches `$this->faker`, so factories work without it. Consistent with the failure output: all 17 errors named Mockery, none named Faker. ## `laravel/sail` — removable No dependents in `composer.lock`. `docker/dev/podman-sail-alias.sh` wraps `podman-compose` directly and does not use the package; both are independently unused. ## Final scope **Removed:** `fakerphp/faker`, `laravel/sail`, `docker/dev/podman-sail-alias.sh`, `faker_locale` from `config/app.php`, `APP_FAKER_LOCALE` from `.env` and `.env.example`. **Kept:** `mockery/mockery` — required by the framework's testing layer. **No action:** `.phpunit.result.cache` was never tracked. ## Lesson "Not referenced in our code" is not evidence a dependency is unused. Framework internals can require a package the application never names. The check that mattered was running the suite with it gone.
Author
Owner

Done — 181e0cb

Removed: fakerphp/faker, laravel/sail, docker/dev/podman-sail-alias.sh, the faker_locale key in config/app.php, and APP_FAKER_LOCALE from .env and .env.example.

require-dev is now seven packages, all verified in use.

Kept: mockery/mockery — see the correction above. Removing it broke all 17 tests; Laravel's RefreshDatabase runs migrations through PendingCommand, which uses Mockery directly.

No action: .phpunit.result.cache was never tracked.

Gates

PHPUnit 17 tests · PHPStan 0 errors (level 7) · Pint 26 files · app serving 200.

Final acceptance criteria

  • .phpunit.result.cache untracked — never tracked
  • fakerphp/faker and laravel/sail removed; composer.lock updated
  • mockery/mockery retained — required by the framework's testing layer
  • faker_locale and APP_FAKER_LOCALE removed
  • docker/dev/podman-sail-alias.sh removed
  • All three gates pass
## Done — `181e0cb` **Removed:** `fakerphp/faker`, `laravel/sail`, `docker/dev/podman-sail-alias.sh`, the `faker_locale` key in `config/app.php`, and `APP_FAKER_LOCALE` from `.env` and `.env.example`. `require-dev` is now seven packages, all verified in use. **Kept:** `mockery/mockery` — see the correction above. Removing it broke all 17 tests; Laravel's `RefreshDatabase` runs migrations through `PendingCommand`, which uses Mockery directly. **No action:** `.phpunit.result.cache` was never tracked. ### Gates PHPUnit 17 tests · PHPStan 0 errors (level 7) · Pint 26 files · app serving 200. ### Final acceptance criteria - [x] ~~`.phpunit.result.cache` untracked~~ — never tracked - [x] `fakerphp/faker` and `laravel/sail` removed; `composer.lock` updated - [x] `mockery/mockery` retained — required by the framework's testing layer - [x] `faker_locale` and `APP_FAKER_LOCALE` removed - [x] `docker/dev/podman-sail-alias.sh` removed - [x] All three gates pass
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lvl0/incr#63
No description provided.