-1

In my regular Laravel project I have both regular .php files with classes and .blade.php files for the templates of my project. When searching in PHPStorm with a file mask on, I have the option to filter with *.blade.php to only see my blade templates. But when I filter with *.php I find both .php files and .blade.php files because both file types end in a similar way. I would like to filter in such a way that only .php files are found, thus excluding Blade files in some way.

In the PHPStorm documentation I found the following relevant section: https://www.jetbrains.com/help/phpstorm/finding-and-replacing-text-in-project.html#exclude_type However, this documentation does not explicitly specify how to exclude files in this way.

What is the correct syntax to make this happen?

(As of this writing, no Stackoverflow questions have been asked yet featuring this specific php/blade file mask use-case.)

Robin Bastiaan
  • 572
  • 2
  • 8
  • 21
  • 4
    duplicate of https://stackoverflow.com/questions/61725905/how-to-set-filename-mask-in-phpstorm-search-to-exclude-test-files-phpunit – N69S Apr 22 '22 at 10:31
  • @N69S I had already found that link, and I do not consider that a duplicate because it does not answer this specific use-case. In that question they are talking about searching within a file name and not a file extension. Also, when Googling for the Blade/PHP situation, that question does not pop up. – Robin Bastiaan Apr 22 '22 at 10:54
  • That's not true. The accepted answer in a linked question works perfectly for your case: https://i.gyazo.com/8150b21b10bf3d5d1ab6be70a2e543a9.mp4 – Dmitrii Apr 22 '22 at 14:25
  • Does this answer your question? [How to set filename mask in PhpStorm search to exclude \*test\* files (PHPUnit)](https://stackoverflow.com/questions/61725905/how-to-set-filename-mask-in-phpstorm-search-to-exclude-test-files-phpunit) – Dmitrii Apr 22 '22 at 14:25
  • @Dmitrii Thank you for your interest into this question and your demonstration. Altho I do agree that that question explains how the syntax is used, it does not explain it for this topic. In your video you write `!*.blade.php` and not `!*test.php` as used in the other question. Since this question/situation would pop up in every Laravel developer at some time, and not the PHPUnit version, I would recommend featuring this specific php/blade file mask use-case to be found more easily as a non-duplicate. – Robin Bastiaan Apr 22 '22 at 15:31

1 Answers1

1

The correct syntax is as follows:

*.php,!*.blade.php

Explanation:

  • The comma separates the file types
  • The exclamation mark negates/excludes that specific result

You can find more information on the available wildcards here: https://www.scootersoftware.com/v4help/index.html?file_masks.html

Relevant part from that link:

Wildcards

Wildcards allow a file mask to match multiple folder or file names.

  • ? Matches any single character.
  • * Matches zero or any other amount of characters.
  • [az] Matches any single character in the set (a or z).
  • [a-z] Matches any single character in the range (from a to z).
  • [!az] Matches any single character not in the set (not a and not z).
  • [[] Matches a single [ character.
Robin Bastiaan
  • 572
  • 2
  • 8
  • 21
  • Dont post links in your answer as it may be inaccessible in the future, it's better to add the relevant part in your question on top of the link. – N69S Apr 22 '22 at 10:33
  • @N69S Thank you for your suggestion; I have added that in the answer now. – Robin Bastiaan Apr 22 '22 at 10:58