Skip to content

Find the plugin file when the directory name doesn't match - #31

Merged
johnbillion merged 1 commit into
trunkfrom
fix/plugin-file-detection
Oct 21, 2026
Merged

johnbillion merged 1 commit into
trunkfrom
fix/plugin-file-detection

Conversation

@johnbillion

@johnbillion johnbillion commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

When pluginFile isn't set, wp-compat looks for {directory name}.php. This fails in git worktrees and any other checkout whose directory isn't named after the plugin, and PHPStan reports it as an internal error with a stack trace and a request to file a PHPStan bug.

This PR:

  • Falls back to scanning the top-level PHP files for a Plugin Name header, as WordPress' get_plugins() does.
  • Replaces the "No plugin or theme file found" exception with a message that says which config parameters to set.
  • Gives a specific message when the configured pluginFile doesn't exist.

Written with AI assistance (Claude Code).

Note: composer test:phpstan reports assign.overwritten for $methodName in processMethodCall(). That's existing code and is not changed here.

…ame, and show a helpful error when it can't be found.
@johnbillion
johnbillion merged commit 5bc1ad5 into trunk Oct 21, 2026
13 checks passed
@johnbillion
johnbillion deleted the fix/plugin-file-detection branch October 21, 2026 20:54
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