Giter Site home page Giter Site logo

Comments (3)

gsherwood avatar gsherwood commented on May 7, 2024

Yes, it was changed to provide this feature: #263

from php_codesniffer.

adamculp avatar adamculp commented on May 7, 2024

So, this leads to a question: If I alter visibility to match the new 'public', will this render sniffs broken if we set https://github.com/wimg/PHPCompatibility to match and someone uses the old version of Codesniffer which is still set to "protected"?

Basically, is it looking for a 1 to 1 match on visibility or is it requiring equal to or more permissive than Codesniffer extended sniff? (see https://github.com/wimg/PHPCompatibility/blob/master/Sniffs/PHP/NewFunctionsSniff.php for reference)

from php_codesniffer.

gsherwood avatar gsherwood commented on May 7, 2024

If you want to support both 1.x and 2.x for a custom standard, you'll probably need 2 versions of your standard. So many things have changed in 2.x that maintaining backwards compatibility is very hard. Possible, depending on what you do, but difficult.

For your specific case, PHP_CodeSniffer itself is not looking for anything. PHP will be the one checking the visibility and throwing an error if it doesn't match.

If you don't want to version your standard, you're probably better off not extending the ForbiddenFunctions sniff at all. Either that, you you create a wrapper sniff for the check and then either include the old class or the new class depending on the PHPCS version. If $phpcsFile->fixer exists, you know it is 2.x

from php_codesniffer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.