Questions tagged [psr-2]

PSR-2 is a PHP Standards Recommendation containing PHP's Coding Style Guide.

PSR-2 is a PHP Standards Recommendation containing 's Coding Style Guide. It extends and expands .

67 questions
0
votes
1 answer

Is using objects without invoking variable PSR compatible?

Let's say I want to use someClass only once per method. Is such style is PSR compatible? class Foo { public function myMethod($x) { // ... code ... $data = (new someClass())->getSomething($x); // ... code ... …
Peter
  • 16,453
  • 8
  • 51
  • 77
0
votes
0 answers

PhpStorm is generating weird whitespaces

When using PhpStorm on Ubuntu - I think I didn't have this problem under OS X - and copy some text, than PhpStorm somehow adds whitespaces to the line. I can see this, because I've got phpcs installed which tells me that x whitespaces are found at…
Musterknabe
  • 5,763
  • 14
  • 61
  • 117
0
votes
1 answer

Php Code Sniffer validation issues

I am trying to make my php code psr-1 psr-2 compliant Don't i am getting some weird errors actually i am not understanding what exactly it want me to solve :( Issue-1 Error: Opening parenthesis of a multi-line function call must be the last content…
0
votes
1 answer

Can I set intelliJ to highlight php coding style?

I used Pycharm a lot and it automatically highlighted not only syntax errors, but also coding style (PEP8). Now I use IntelliJ with PHP plugin (it's basically PHPstorm) and I want it to tell me if my code is fitting PSR-2 style. My PyCharm…
Zbigniew Kisły
  • 692
  • 1
  • 6
  • 12
0
votes
1 answer

PHPStorm: Set Number of Spaces per Tab by Directory?

The coding standards at my current company requires 2 spaces per tab for PHP code (Drupal 6). I'm in the process of adding autoloading (PSR-4) so we can start using classes and OOP. The new namespace points to a classes/src directory that I wish to…
JudRoman
  • 743
  • 1
  • 6
  • 8
-1
votes
2 answers

How many spaces should I use for intendation according to the PSR-2 coding standard?

I was unable to find out how many spaces we have to use for intendation according to the PSR-2 standard. Can I use as many as I like? I always use 4 spaces public function test() { //4 spaces But I also saw code which uses more than 24 spaces.…
Black
  • 18,150
  • 39
  • 158
  • 271
-1
votes
2 answers

PHP PSR validator

I am looking for a tool that can check my PHP codes and automatically update into as per PSR standard or atleast point out the places where code violates PSR standards. Google search was not too helpful. Is there a tool that can do it ?
Kamrul Khan
  • 3,260
  • 4
  • 32
  • 59
1 2 3 4
5