Skip to content

Require PHP 8.4, fix GlobalExceptionSniff, clean up tooling - #15

Merged
temp merged 11 commits into
mainfrom
chore/php84-cleanup
Nov 3, 2026
Merged

temp merged 11 commits into
mainfrom
chore/php84-cleanup

Conversation

@temp

@temp temp commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Changes

GlobalExceptionSniff

  • Only inspect throw new <Class> (parentheses after throw are skipped); throw $e no longer reports an unrelated class name further down the file
  • Own name resolution per namespace block: multiple namespaces per file (bracketed and unbracketed), namespace { }, aliases, group uses (use Foo\{Bar, Baz as Qux}), namespace\ relative names; use function / use const are ignored
  • Unqualified throw new Exception() in the global namespace is now reported
  • Case-insensitive comparison, resolved name in the message, error stays on the throw token
  • Not checked on purpose: throw $e, throw new $class, anonymous classes, throw X::create()
  • Typed constants and native parameter types

⚠️ May report new errors in projects, e.g. throw new Exception() in files without namespace.

Ruleset

  • No functional change. Removed dead entries: the UnionTypeHintFormat exclusion (not used by Doctrine 14 anymore) and the DNFTypeHintFormat reference (already configured by Doctrine 14, the former <rul> typo had no effect)
  • ChangedFromDoctrineCodingStandard.php integration input was invalid PHP and tested nothing; it now covers all excluded Doctrine rules (Doctrine reports 4 violations, Brainbits 0)

PHP 8.4 / dependencies

  • "php": "^8.4", PHPUnit ^13.4, slevomat/coding-standard ^8.23 (minimum of Doctrine 14)
  • CI matrix: PHP 8.4 and 8.5; drop no-op --no-suggest; run self-check vendor/bin/phpcs in CI
  • CI: cache the real composer cache dir (~/.composer/cache did not exist, nothing was cached), separate cache keys for lowest/highest, read-only GITHUB_TOKEN
  • phpcs.xml.dist now also checks tests/ (without fixtures/inputs)
  • PHPUnit config migrated to 13.4 schema, .phpunit.cache ignored
  • Removed broken composer tests script

Dependabot / Renovate

  • Dependabot: add composer ecosystem (major bumps only, fix(deps) / chore(deps)), group GitHub Actions updates; dependencies label now exists in the repo
  • Remove unused renovate.json

Docs

  • README: correct standard name Brainbits, describe differences to Doctrine and the custom sniff precisely, development section; drop Docker section
  • Add MIT LICENSE, add CLAUDE.md
  • Remove unmaintained CHANGELOG.md and outdated example/ / docs/ files

Tests

Locally on PHP 8.5 with highest and lowest dependencies: PHPUnit (14 tests), ruleset integration report and self-check green.

🤖 Generated with Claude Code

temp and others added 7 commits November 3, 2026 17:10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fix `<rul>` typo in ruleset so DNFTypeHintFormat is actually applied
- Require PHP ^8.4 and PHPUnit ^13.4, test PHP 8.4 and 8.5 in CI
- Remove broken `composer tests` script
- Update PHPUnit config schema to 13.4
- Use correct standard name `Brainbits` in README, drop Docker section
- Remove unmaintained CHANGELOG.md
- Update CLAUDE.md accordingly

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Watch composer dependencies via Dependabot (major bumps only)
- Group GitHub Actions updates into one PR
- Remove unused renovate.json

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Register on T_THROW and only inspect `throw new <Class>`, so `throw $e`
  no longer reports an unrelated class name further down the file
- Resolve names via namespace and use statements: unqualified names in the
  global namespace, qualified and relative names are handled correctly
- Compare class names case-insensitively
- Report on the class name and use the resolved name in the message
- Use typed constants and native parameter types (PHP 8.4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ChangedFromDoctrineCodingStandard.php was not valid PHP and therefore did
  not test anything; it now covers all excluded Doctrine rules
- Remove exclusion of UnionTypeHintFormat (no longer used by Doctrine 14)
  and the DNFTypeHintFormat reference (already configured by Doctrine)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Include tests/ in phpcs.xml.dist (without fixtures) and run it in CI
- Require slevomat/coding-standard ^8.23 (minimum of doctrine 14)
- Drop no-op --no-suggest, ignore .phpunit.cache, clean PHPUnit config
- Update CLAUDE.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add MIT license text (composer.json already declares MIT)
- README: describe the standard, differences to Doctrine, the custom
  GlobalException sniff and the development workflow
- Remove unused example/ and docs/ files from 2017/18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@temp temp changed the title chore: Require PHP 8.4, fix ruleset typo, clean up tooling Require PHP 8.4, fix GlobalExceptionSniff, clean up tooling Nov 3, 2026
temp and others added 4 commits November 3, 2026 17:48
Review findings on the Slevomat based name resolution:
- Files with several namespaces used the imports of another namespace
- Code inside `namespace { }` was resolved against a "{" namespace
- Group uses were ignored and resolved against the global namespace
- `throw (new Exception())` was not reported anymore

Imports are now collected per namespace block, including group uses and
skipping function/const imports. Parentheses after throw are skipped.
Errors are reported on the throw token again, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Cache the actual composer cache dir, ~/.composer/cache does not exist
  on the runner and nothing was cached
- Separate cache keys for lowest and highest dependencies
- Read-only GITHUB_TOKEN

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Doc comments are tokenized as T_DOC_COMMENT_* tokens and ended up in the
parsed import name, e.g. `use Foo\{ /** doc */ Exception };`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@temp
temp merged commit 7bfddf0 into main Nov 3, 2026
4 checks passed
@temp
temp deleted the chore/php84-cleanup branch November 3, 2026 17:06
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 8.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant