-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespaces are a valid alternative to prefixing for constants #1056
Comments
@grappler Good point. I've got a PR ready for this, but will wait to pull this until 0.13.0 has been released. |
Related, is this false positive: add_action( 'after_setup_theme', __NAMESPACE__ . '\\load_textdomain', 5 );
/**
* Load theme text domain.
*
* @since 1.0.0
*/
function load_textdomain() : void {
\load_child_theme_textdomain( 'my-textdomain', get_stylesheet_directory() . '/languages' );
} Gives: 94 | ERROR | Functions declared by a theme/plugin should start with the theme/plugin prefix. Found: "load_textdomain". (WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound) |
@GaryJones I presume your code sample is missing a If not, this is not a false positive as without a namespace at the top of the file (or a scoped namespace) |
No.... it seems my file didn't have the namespace declared... Sorry 😊 My issue is not a bug. |
@GaryJones Happens to the best of us ;-) |
I have the following code in a plugin:
define( __NAMESPACE__ . '\PLUGIN_FILE', __FILE__ );
I am getting a warning for this
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
Namespaces are a valid alternative to prefixing.
Related to #764
The text was updated successfully, but these errors were encountered: