Detect static methods referenced in composer.json scripts - #397
Merged
Conversation
Fixes #396 Co-Authored-By: Claude Code
Composer only executes scripts of the root package, so there is exactly one relevant composer.json per autoloader. Co-Authored-By: Claude Code
Script callbacks are resolved to their declaring class at load time via ReflectionProvider (same approach as NetteUsageProvider), so callbacks referencing inherited methods keep working. Co-Authored-By: Claude Code
janedbal
marked this pull request as ready for review
July 10, 2026 09:53
Co-Authored-By: Claude Code
Contributor
|
thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #396
Adds a new default-enabled
ComposerUsageProviderthat marks static methods referenced as PHP callbacks in thescriptssection ofcomposer.json(e.g."post-install-cmd": "MyVendor\\MyClass::postInstall") as used.Composer\EventDispatcher\EventDispatcher::isPhpScript: an entry is a PHP callback iff it contains::and no space;@scriptreferences and shell commands are ignored, leading backslash is trimmedcomposer.jsonis autodetected from the registered autoloader's vendor dir; configurable viashipmonkDeadCode.usageProviders.composer.composerJsonPath(single path, since Composer only executes scripts of the root package)ReflectionBasedMemberUsageProvider; callbacks are resolved to their declaring class at load time viaReflectionProvider, so callbacks referencing inherited methods keep workingCo-Authored-By: Claude Code