DJ Far
DJ Far

Reputation: 506

PHPStorm showing syntax errors in CakePHP 3 ctp files

CakePHP 3.0 introduces Rails-style erb tags in it's bake template files (.ctp).

The tags, <% and %>, and derivitives, expand to the php <? and ?> when the template is processed.
However, since PHPStorm doesn't recognize the tags (I've configured .ctp files as php as per Display CTP Files as PHP Files in PHPStorm) as legal php syntax, it decorates all files containing these tags with red squiggly underscore signifying syntax errors.

Anyone know how to include these tags as legal syntax so PHPStorm stops flagging them as errors?

Upvotes: 2

Views: 1072

Answers (1)

Sergio
Sergio

Reputation: 2469

Easy AutoComplete in PHPStorm 8 and 9, for CakePHP 3.x in Views, Template, "*.ctp"

CakePHP 3.x Insert in file all, the next code, line 1 for CakePHP 3.x:

<?php /** @var \Cake\View\View $this */ ?>

CakePHP 2.x Insert in file all, the next code, line 1 for CakePHP 2.x:

<?php /** @var $this View */ ?>

;-)

Print Example in Action for CakePHP 3.x to PHPStorm 8: http://s25.postimg.org/ovkjbgtbj/Print_de_pantalla_579.jpg enter image description here

Upvotes: 1

Related Questions