We use relative path detection in ValidateDomain and ValidateHooks sniffs. It works well when we run phpcs as a standalone process. However, in PhpStorm the relative path was detected improperly, providing the following distorted messages:
This happed because PhpStorm runs phpcs on a copy of the PHP file, located in the temp folder. The current fix provides processing of this special case.
Testing procedure
Open any old file having hooks not by the current standard, for instance, wp-content/plugins/wpforms/includes/class-frontend.php:1416. Hover on the line 1416:
Make sure that popup message in PhpStorm is: "phpcs: WPForms.PHP.ValidateHooks.InvalidHookName: The wpforms_frontend_captcha_inline_script is invalid hook name. The hook name should start with wpforms_includes_class-frontend."
Description
We use relative path detection in ValidateDomain and ValidateHooks sniffs. It works well when we run phpcs as a standalone process. However, in PhpStorm the relative path was detected improperly, providing the following distorted messages:
This happed because PhpStorm runs phpcs on a copy of the PHP file, located in the temp folder. The current fix provides processing of this special case.
Testing procedure
Open any old file having hooks not by the current standard, for instance,
wp-content/plugins/wpforms/includes/class-frontend.php:1416
. Hover on the line 1416:Make sure that popup message in PhpStorm is: "phpcs: WPForms.PHP.ValidateHooks.InvalidHookName: The wpforms_frontend_captcha_inline_script is invalid hook name. The hook name should start with wpforms_includes_class-frontend."