2

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?

1
  • AFAIK ( as per WI-8638) ASP-style tags are now disabled in PhpStorm. I may only suggest to download an older version of IDE (8.0.1 or older) and try there. Or wait few weeks (no official dates yet) and see if it will be working in v9 EAP build (v9 final is planned for Q2 2015). Commented Feb 26, 2015 at 20:51

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Even better AppView instead of view or not? No need to memorize the namespace either, double tap ctrl+space invokes autocomplete.

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.