php - PHPCS Allow simple methods in one line -


i find code

$ids = array_map(function ($entity) { return $entity->getid(); }, $entities); 

much more readable than

$ids = array_map(function ($entity) {      return $entity->getid();  }, $entities); 

however, phpcs forces me use second style, because first 1 fails following psr-2 styles:

  • squiz.functions.multilinefunctiondeclaration.contentafterbrace says opening brace must last content on line
  • squiz.whitespace.scopeclosingbrace.contentbefore says closing brace must on line itself
  • generic.formatting.disallowmultiplestatements.sameline says each php statement must on line itself

while agree these checks in other places, in case wrong.

is there rule phpcs should allow simple methods in 1 line phpstorm does?

simple methods in 1 line in phpstorm

i know can ignore phpcs checks in such places prefer tackling in global configuration.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -