Skip to content

chore(composer): drop the dead src/ PSR-4 autoload mapping - #27

Merged
Herm71 merged 1 commit into
mainfrom
chore/24-drop-empty-psr4-mapping
Aug 4, 2026
Merged

chore(composer): drop the dead src/ PSR-4 autoload mapping#27
Herm71 merged 1 commit into
mainfrom
chore/24-drop-empty-psr4-mapping

Conversation

@Herm71

@Herm71 Herm71 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Closes #24.

What

Removes the autoload block from composer.json:

"autoload": {
    "psr-4": {
        "UCSC\\UcscCommunicationsFunctionality\\": "src/"
    }
}

autoload-dev (UCSC\UcscCommunicationsFunctionality\Tests\tests/) is kept — the PHPUnit suite genuinely uses it.

Why

Option A from the issue, which is the one it recommends. The mapping was inert on three counts:

  1. No src/ directory exists.
  2. No namespaced classes exist — all code is procedural, loaded by require_once from plugin.php.
  3. plugin.php never requires vendor/autoload.php, and vendor/ is gitignored and not shipped by npm run zip.

So it loaded nothing and broke nothing, but advertised an architecture the plugin doesn't have.

Option B (build into src/) was rejected as out of scope: it means restructuring all current procedural code, requiring the autoloader at runtime, and shipping vendor/ or a generated production autoloader in the release zip — otherwise the plugin fatals on activation. If classes land later, the autoload block comes back in the same commit as the first class, along with that packaging work.

Docs

  • CLAUDE.md — the "Namespace / autoloading" section now describes the procedural reality and records what re-adding autoloading would require; the stale Known quirks entry is removed.
  • ROADMAP.md — the Deferred / not planned entry is replaced with a "Resolved after the audit" record carrying the cause and fix, matching how the other nine items are kept.

Acceptance criteria

  • composer.json and the on-disk layout agree — the mapping is gone.
  • composer run lint still exits 0 (4/4 files, zero errors, zero warnings).
  • CLAUDE.md and ROADMAP.md entries updated.

Verification

composer run lint    → exits 0, zero errors, zero warnings
phpunit              → OK (22 tests, 38 assertions)
composer validate    → ./composer.json is valid (lock file unaffected)

PHPUnit was run via the container fallback documented in CLAUDE.md, since the local php8.5 lacks ext-mbstring.

🤖 Generated with Claude Code

composer.json mapped UCSC\UcscCommunicationsFunctionality\ to src/, but the
mapping was inert: no src/ directory, no namespaced classes, and plugin.php
never requires vendor/autoload.php. vendor/ is gitignored and `npm run zip`
does not ship it, so nothing autoloaded could have survived packaging either.

Removes the `autoload` block only. `autoload-dev` (…\Tests\ -> tests/) stays,
since the PHPUnit suite genuinely uses it.

Building into src/ was the alternative and is out of scope here — it means
restructuring all current procedural code, requiring the autoloader at runtime,
and shipping vendor/ or a production autoloader in the release zip. If classes
land later, the autoload block returns in the same commit as the first class.

Docs updated to match: the CLAUDE.md "Namespace / autoloading" section now
describes the procedural reality, and the stale quirk/deferred entries in
CLAUDE.md and ROADMAP.md are replaced with a resolution record.

Closes #24

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Herm71
Herm71 merged commit 4dd23da into main Aug 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve the empty src/ PSR-4 mapping in composer.json

1 participant