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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -