On PhpStorm 9 I have associated *.ctp
with PHP.
I have also created my own Bake Theme
http://book.cakephp.org/3.0/en/bake/development.html#creating-a-bake-theme.
Because inside these files there is code written like this
<%
$done = [];
foreach ($associations as $type => $data):
foreach ($data as $alias => $details):
if (!empty($details['navLink']) && $details['controller'] !== $this->name &&
!in_array($details['controller'],
$done)):
%>
It shows these files with red underline like the have an error. PhpStorm doesn't recognize <%
and other stuff like this as valid PHP code. But it doesn't only show these files it also shows all the parent folders too and I don't know if there is actually an error on these folders and sometimes I go through the folders to check again. Just to be sure.
One way to solve this would be to change the extension of the files to something else. So they won't be associated anymore with PHP. But I don't know how I can tell CakePHP to bake the template from files with different extension than *.ctp.
The other solution would be to tell PhpStorm to ignore a certain path from inspections but I don't know how to do this either.
Changing the extension used by the bake view doesn't seem to be possible, while you can get access to the view class via the Bake.initialize
event, the property that holds the extension is protected and can only be changed via inheritance.
A quick fix on the IDE side of the story would be exclusions.
Right Click > Mark Directory As > Excluded
This will exclude the folder from search, inspections, code completion and indexing.
See also https://www.jetbrains.com/phpstorm/help/directories.html