Questions tagged [psr-12]

This tag must only be used for questions that specifically relate to the PSR-12 coding standard for PHP. Do not tag general PHP questions with this tag nor use it for other coding standards such as PSR-1 and PSR-2.

Questions tagged with psr-12 refer to the PSR-12: Extended Coding Style which is defined here.

The PSR-12 coding style is intended to extend and replace PSR-2 and arheres to the requirements outlined in PSR-1.

PSR-12 is intended to reduce the difficulties associated with reviewing code written by different authors by declaring specific rules around the formatting of PHP code.

20 questions
0
votes
1 answer

PSR-12 - method chaining, line breaks, and indentation

What is the correct indentation for the following code examples according to PSR-12? $object->method1(function () { # do things }) ->method2(function () { # do things }); and $object->method1( $val1, $val2, ...…
PeanutsMcgee
  • 55
  • 1
  • 8
0
votes
1 answer

PSR-12 if statement

Can I use if statement like: if (!true) { return false } Or something like this: if (! true) { return false }
Dmitry Leiko
  • 3,970
  • 3
  • 25
  • 42
0
votes
1 answer

Atom editor - set it to codeigniter standard - PSR12

I'm thinking about changing from sublime text 3 to atom and i want to set the identation standard for codeigniter 4, PSR12. I've installed globaly via composer the following packages: PHP_CodeSniffer Codeigniter4-Standard PHP-CS-Fixer Using the…
Emerson Nunes
  • 386
  • 4
  • 17
0
votes
1 answer

Is there a way to break down a namespace in PHP?

I found myself looking on the internet for someone who has already answered it, but I can't find any. I was cleaning up some code with a strict PSR12 standard, and I found this issue with namespace getting longer than the configured 80 characters…
-1
votes
2 answers

PHP var declaration best practices

I always try to code with the best practices possible, and regarding PHP, I use mainly the PSR-12 standards. Now regarding var declarations, is it "wrong" to use tabs like the example below? $a = 1; $abc = 2; $abdef = 3; Or should I keep…
Tiago Mateus
  • 356
  • 4
  • 17
1
2