Skip to content

fix: bounded config fixes for the PHP CI gates#49

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/config-gates
Jun 24, 2026
Merged

fix: bounded config fixes for the PHP CI gates#49
hyperpolymath merged 1 commit into
mainfrom
fix/config-gates

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Keeps the library PHP (defensive PHP-security tooling — we protect PHP devs). Config-only, PHP-native fixes for the failing gates:

(a) PHPUnit — undefined aegis_ functions.* Added autoload.files for src/WordPress/Adapter.php (PSR-4 only autoloads classes, never free functions). Also moved the ~20 aegis_* helpers from PhpAegis\WordPress into the global namespace: they are WordPress-style globals invoked unqualified (aegis_html(...)) and depend on PHP's global-function fallback — while namespaced they were unresolvable from the test namespaces (PhpAegis\Tests\*). use imports retained so the underlying class refs (Sanitizer::html, etc.) still resolve.

(b) composer.lock — NOT included. Cannot be generated without a Composer runtime in this environment; deliberately not fabricated. Needs composer install / composer update to commit.

(c) PHP-CS-Fixer exit 16 (invalid v3 config). Removed bogus no_eval (no such fixer exists) and renamed no_unneeded_curly_bracesno_unneeded_braces (renamed in php-cs-fixer 3.x).

(d) Security Pattern Check false positives. Added \b word boundaries so curl_exec() no longer matches \bexec\(, and anchored the backtick check (plus a quoted-string exclusion) so the library's own escaped backtick character inside its Turtle/URI validators isn't flagged. Verified: zero matches on src/ now, while a bare exec( is still caught.

(e) PHPStan L9 — NOT attempted here (out of scope per the request). No baseline added: generating an accurate phpstan-baseline.neon requires running PHPStan (no PHP runtime here), and reportUnmatchedIgnoredErrors: true would fail on a fabricated/stale baseline. Remains for a PHP-runtime follow-up if L9 surfaces genuine strict errors.

Verified statically (no PHP runtime in env): composer.json is valid JSON; the new security-pattern regexes match nothing in src/ yet still flag a bare exec(.

🤖 Generated with Claude Code

Keeps the library PHP (defensive PHP-security tooling). Config-only fixes:

- composer.json: add autoload.files for src/WordPress/Adapter.php so the
  aegis_* WordPress-adapter functions are loaded (PSR-4 only autoloads
  classes, never free functions).
- Adapter.php: move the aegis_* helpers to the GLOBAL namespace (was
  PhpAegis\WordPress). They are WordPress-style globals invoked unqualified
  (aegis_html(...)) and rely on PHP's global-function fallback; namespaced,
  the ~20 functions were unresolvable from the test namespaces. 'use'
  imports retained so the underlying class refs still resolve.
- .php-cs-fixer.dist.php: fix invalid v3 config (exit 16): drop bogus
  'no_eval' (no such fixer) and rename 'no_unneeded_curly_braces' ->
  'no_unneeded_braces'.
- php-lint.yml Security Pattern Check: add \b word boundaries so curl_exec()
  no longer matches \bexec\(, and anchor the backtick check + exclude
  quoted-string contexts so the library's own escaped backtick char in its
  Turtle/URI validators is not flagged.

Verified statically (no PHP runtime in env): composer.json is valid JSON;
new security-pattern regexes produce zero matches on src/ while still
catching a bare exec(. composer.lock and the PHPStan L9 baseline still
require a PHP runtime (see PR notes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hyperpolymath
hyperpolymath merged commit a6e8828 into main Jun 24, 2026
17 of 27 checks passed
@hyperpolymath
hyperpolymath deleted the fix/config-gates branch June 24, 2026 14:15
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant