How to exclude files / folders from code verification in PHPStorm?

I have a project in PHPStorm that contains several libraries (Zend, Doctrine, ...) grouped in a library folder.

When checking the code, I want the PHP code in these folders to be parsed (so that PHPStorm will know how Zend_Form declared).

However, I do not want messages found in these folders to be sent because they cannot be controlled.

The only workaround I have found so far is to mark the directories as "Test Source" and uncheck "Enable Test Sources" in the code verification window. Needless to say, this is not the best solution!

+53
phpstorm
Jun 21 2018-12-12T00:
source share
5 answers

Refer to the Scopes function. You can define a custom area only for your code without a library folder, and then perform checks only in that area.

In Inspections> settings, you can also add areas and enable / disable each scan for each area.

+42
Jun 21 '12 at 10:33
source share

If you just need to disable checks in one or two files, you can easily disable it at the file level:

  • Open file with violation
  • Click Code → Current File Analysis
  • Set the slider for language violation to "No"

(using PHPStorm 8.0.2)

+47
Jan 21 '15 at 21:42
source share

If you need to completely exclude several files from any analysis (for example, a compiled php file), for example, it does not even exist, you can right-click on the file in the source tree and select "Mark as plain text". This action completely removes any checks from this file. With this, I deleted a lot of “duplication sources” notifications in Laravel 5.

If you need to activate it again - right-click again and "Mark as PHP".

This works well for multiple files. If you need to exclude the whole directory with everything internal, use the directory marking from the settings or right-click on the directory and "Mark directory as → Excluded".

+5
Apr 08 '15 at 12:30
source share

There is an alternative solution. You can add read-only libraries to the Include path under Settings » PHP .

This is not the same with the php.ini include_path , just referring to some dirs as external, out of your control. Exactly what you need.

As a result

  • no problem with defining areas, just check the whole project if necessary
  • no useless version control add-ons in libs
+3
Nov 19 '13 at 13:44 on
source share

If you want to completely exclude a file or folder from the completion code and code:
Right-click the folder or file in your file browser (on the left), select Mark → Excluded

What I wanted, I add this answer here because I found this question on Google when I was looking for the answer.

+1
Aug 02 '17 at 0:05
source share



All Articles