0

I code in PHPStorm and include wp-admin and wp-include in my path, but get code inspection warnings related to undefined / unused variables.

Should I be concerned about these? How would I go about satisfying a resolution to resolve the error (without just turning inspection off)

enter image description here

1
  • The value of the var comes from the user so can I just define var = null before extract? Commented Jul 1, 2014 at 18:47

2 Answers 2

4

This happens because you are using extract(), and PHPStorm cannot know where the variable is coming from. Do not use extract(). Ever.

It was removed from almost all WordPress functions, and so should you do.

1

If you really want to use it, you can add a comments before your variable like this:

/** @var $number integer */

It will prevent a warnings in PHPStorm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.