Hello,
I'm evaluating (30 days trial) PHP Tools for VS Code in a WordPress project and noticed two limitations regarding WordPress hook callbacks.
Example:
public function __construct() {
add_action( 'wp_enqueue_scripts', [ __CLASS__, 'enqueueScripts' ] );
add_action( 'wp_enqueue_scripts', [ __CLASS__, 'nonExistingMethod' ] );
}
public static function enqueueScripts(): void {
// ...
}
Issue 1: Missing validation
When a callback references a non-existing method, for example:
[ __CLASS__, 'nonExistingMethod' ]
PHP Tools does not report any warning or error, even though WordPress will trigger a fatal error when the hook is executed.
It would be very useful if PHP Tools could validate callback arrays and report missing methods.
Issue 2: No navigation support
For valid callbacks such as:
[ __CLASS__, 'enqueueScripts' ]
Ctrl+Click / Go to Definition on the method name string ('enqueueScripts') does not navigate to the corresponding method definition.
Since this callback syntax is extremely common in WordPress development, it would be very helpful if PHP Tools could treat these callback arrays as method references and provide:
Go to Definition
Find References
Rename Symbol support
Validation of missing methods
Is this functionality already available through a setting, or is it something that could be considered for a future release?
Thank you.