Skip to content
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

translate() sniff returns false negative for $obj->translate() #1535

Closed
1 task
roborourke opened this issue Nov 14, 2018 · 3 comments
Closed
1 task

translate() sniff returns false negative for $obj->translate() #1535

roborourke opened this issue Nov 14, 2018 · 3 comments

Comments

@roborourke
Copy link

Bug Description

I'm using the Google Translate API client, you get the client object and that has a translate() method.

The sniff WordPress.WP.I18n.NonSingularStringLiteralDomain catches any usage of translate() stating it's reserved for low level usage.

Minimal Code Snippet

<?php
class Translator {
    function translate() {
       return 'foo';
    }
}
$translator = new Translator();
echo $translator->translate();

Environment

Question Answer
PHP version 7.2
PHP_CodeSniffer version 2.9.0
WPCS version 0.14.0
WPCS install type Composer project local

Tested Against develop branch?

  • I have verified the issue still exists in the develop branch of WPCS.
@jrfnl
Copy link
Member

jrfnl commented Nov 14, 2018

@roborourke Please upgrade the version of WPCS you are using. The current version is 1.2.0.

Closing as duplicate of #1266 which was fixed in WPCS 1.0.0.

@roborourke
Copy link
Author

roborourke commented Nov 14, 2018 via email

@jrfnl
Copy link
Member

jrfnl commented Nov 14, 2018

No worries. When you upgrade, please have a read through the changelogs. Especially WPCS 1.0.0 contains some BC-breaks which you probably should be aware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants