Skip to content

Conversation

@kkmuffme
Copy link
Contributor

@kkmuffme kkmuffme commented Jan 3, 2026

  • don't count undocumented globals (as duplicate) when only including documented globals and vice versa
  • don't cound constants "in if" as duplicates
  • only include documented globals if their docblock contains an @var (or their @psalm/@phpstan equivalent), as otherwise the doc comment (and global) is irrelevant for the stubs - in fact it's often a false positive caused by other annotations (e.g. @package or in WordPress @param for apply_filters assignments)
  • add tests to ensure constants documented in the "define" like define( 'FOOBAR', /** @var int */ 0 ); continue to be correctly added to stubs

@kkmuffme kkmuffme force-pushed the fix-duplicate-count-constants-variables branch from 8737807 to 871fd97 Compare January 3, 2026 14:22
Common false positive in WordPress where a global is annotated with @param since it's assigned the result of an apply_filters
@kkmuffme kkmuffme force-pushed the fix-duplicate-count-constants-variables branch from 871fd97 to 23aeadb Compare January 3, 2026 15:26
@kkmuffme kkmuffme force-pushed the fix-duplicate-count-constants-variables branch from 23aeadb to 11e677e Compare January 3, 2026 15:36
@szepeviktor szepeviktor merged commit 769fe16 into php-stubs:master Jan 3, 2026
8 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.

2 participants