Git Product home page Git Product logo

Comments (2)

sybrew avatar sybrew commented on June 2, 2024 1

Cheers 😄

Yea, Automattic doesn't seem too fond of that function. I don't know why 🤷‍♂; I only found one (convoluted) instance in Jetpack.

And yes, that's exactly what I'm suggesting!

Aside from the example provided above, I use it when passing variadic parameters to my file inclusion handler*.

Here's a reference: https://github.com/sybrew/the-seo-framework/blob/9638de251d856937b135a57dd5d2d663e81a39b8/inc/classes/profile.class.php#L79-L102

The placement of the error is a bit odd in that reference, but that's a common issue with phpcs.
image

* file inclusions from an object method will also pass $this, and make the object accessible in even the private scope, but that's a story for another issue.

from phpcs-variable-analysis.

sirbrillig avatar sirbrillig commented on June 2, 2024

Wow, I somehow never knew about get_defined_vars() before. Thanks for brining this up!

So you're suggesting that if get_defined_vars() is called in a scope, it should disable all unused variable warnings within that scope. That does make sense in the sense that all variables in that scope are being read just by calling that function.

🤔 I'm trying to think of any risks with doing that. Do you have any real-world examples of that function being used that I could reference?

from phpcs-variable-analysis.

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.