Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ inspects `echo`/`print`, so unescaped values in a returned string lint clean.
Simple informational page under **Settings** showing plugin version (linked to GitHub releases) and feature list. Requires `manage_options` capability.

### Namespace / autoloading
`composer.json` defines PSR-4 autoloading: `UCSC\UcscCommunicationsFunctionality\` → `src/`. No `src/` directory exists yet; this is placeholder infrastructure. Current code uses procedural `require_once` includes.
There is none at runtime. All code is procedural, loaded by `require_once` from
`plugin.php`, and `vendor/autoload.php` is never required — `vendor/` is gitignored and
`npm run zip` does not ship it, so nothing autoloaded could survive packaging anyway.

`composer.json` keeps only an `autoload-dev` PSR-4 mapping,
`UCSC\UcscCommunicationsFunctionality\Tests\` → `tests/`, which the test suite does use.
The matching production mapping to `src/` was removed in #24 as dead configuration. If
classes are ever introduced, re-add the `autoload` block in the same commit as the first
class, and remember that shipping them also means requiring the autoloader in `plugin.php`
and including `vendor/` (or a production-only autoloader) in the release zip.

### Tests (`tests/`)
PHPUnit against hand-written WordPress/ACF doubles — no WordPress install, no database,
Expand Down Expand Up @@ -101,9 +110,6 @@ None outstanding. All nine items from the original audit are fixed — see
## Known quirks

- No PHPStan config, no JS build pipeline (no blocks or interactive JS).
- `composer.json` maps PSR-4 `UCSC\UcscCommunicationsFunctionality\` → `src/`, but no
`src/` directory exists; all current code is procedural `require_once` includes.
Tracked as issue #24.
- `plugin.php` header declares `Requires PHP: 7.0`, but `lib/functions/general.php`
uses a `: void` return type (PHP 7.1+), so the plugin actually fatals on 7.0. The
declared floor is wrong. Tracked separately.
Expand Down
28 changes: 24 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,30 @@ deliberate 1000-iteration guard in `have_rows()` that throws instead of hanging

---

## Resolved after the audit

### ~~Empty `src/` PSR-4 mapping~~
**Status:** ✅ Fixed — [#24](https://github.com/ucsc/ucsc-communications-functionality/issues/24)
**File:** `composer.json`

`composer.json` mapped `UCSC\UcscCommunicationsFunctionality\` → `src/`, but three
things made that mapping inert: no `src/` directory existed, no namespaced classes
existed, and `plugin.php` never required `vendor/autoload.php`. `vendor/` is gitignored
and `npm run zip` does not ship it, so even a populated `src/` would not have loaded in
a released build. The mapping loaded nothing and broke nothing — it advertised an
architecture the plugin does not have.

**Fixed by:** dropping the `autoload` block. The `autoload-dev` mapping
(`…\Tests\` → `tests/`) stays, because the test suite genuinely uses it.

Building into `src/` instead was the other option and was rejected as out of scope: it
is a restructuring of all current procedural code, plus requiring the autoloader at
runtime and shipping `vendor/` (or a production autoloader) in the zip. If classes are
introduced later, the `autoload` block should come back in the same commit as the first
class, together with that packaging work.

---

## Deferred / not planned

- **No PHPStan config.** Worth knowing what it would and would not buy here:
Expand All @@ -240,9 +264,5 @@ deliberate 1000-iteration guard in `have_rows()` that throws instead of hanging
for one plugin. Item 4 is covered by tests instead. Still deferred, but for
that reason rather than "not got to it yet". See the `wp-phpstan` workflow if
it is picked up.
- **Empty `src/` PSR-4 mapping.** `composer.json` maps
`UCSC\UcscCommunicationsFunctionality\` → `src/`, but no `src/` directory
exists and all current code is procedural. Either build into it or drop the
mapping.
- **No `uninstall.php`.** Currently correct: the plugin registers no options and
creates no tables, so there is nothing to clean up. Revisit if that changes.
5 changes: 0 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"autoload": {
"psr-4": {
"UCSC\\UcscCommunicationsFunctionality\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"UCSC\\UcscCommunicationsFunctionality\\Tests\\": "tests/"
Expand Down