Skip to content

feat(docblock): recognize @phpstan-sealed tag for class references#190

Open
calebdw wants to merge 1 commit into
PHPantom-dev:mainfrom
calebdw:calebdw/push-rvvnyvzrnmum
Open

feat(docblock): recognize @phpstan-sealed tag for class references#190
calebdw wants to merge 1 commit into
PHPantom-dev:mainfrom
calebdw:calebdw/push-rvvnyvzrnmum

Conversation

@calebdw

@calebdw calebdw commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Add support for the @phpstan-sealed FooClass|BarClass PHPStan tag so that class names referenced in it are treated as type references. This prevents false 'unused import' diagnostics when a use statement is only referenced via @phpstan-sealed.

Changes:

  • symbol_map/docblock.rs: add "phpstan-sealed" to TYPE_FIRST_OTHER_NAMES so the tag's description is parsed as a type and emits ClassReference spans
  • diagnostics/unused_imports.rs: add "@phpstan-sealed" to PHPDOC_TYPE_TAGS so the content safety-net recognizes it
  • completion/phpdoc/context.rs: add "phpstan-sealed" to type-first tags so docblock type completion works after the tag
  • completion/phpdoc/mod.rs: add TagDef for @phpstan-sealed autocomplete

Closes #185

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@calebdw calebdw force-pushed the calebdw/push-rvvnyvzrnmum branch from d5405c5 to ec870ce Compare July 4, 2026 03:07
Add support for the `@phpstan-sealed FooClass|BarClass` PHPStan tag so
that class names referenced in it are treated as type references. This
prevents false 'unused import' diagnostics when a use statement is only
referenced via `@phpstan-sealed`.

Changes:
- symbol_map/docblock.rs: add "phpstan-sealed" to TYPE_FIRST_OTHER_NAMES
  so the tag's description is parsed as a type and emits ClassReference spans
- diagnostics/unused_imports.rs: add "@phpstan-sealed" to PHPDOC_TYPE_TAGS
  so the content safety-net recognizes it
- completion/phpdoc/context.rs: add "phpstan-sealed" to type-first tags
  so docblock type completion works after the tag
- completion/phpdoc/mod.rs: add TagDef for @phpstan-sealed autocomplete

Closes PHPantom-dev#185
@calebdw calebdw force-pushed the calebdw/push-rvvnyvzrnmum branch from ec870ce to 0eb1972 Compare July 4, 2026 04:07
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.

phpstan-require-* and phpstan-sealed rules not recognized

2 participants