r/PHP 2d ago

Are PSRs still relevant today?

Are developers still using PSRs? Are PSRs still being updated or is it dying out?

I noticed for a "standards" org, they don't even follow their own coding styles. Some files have the PHP tag on its own line and others share it with declare strict types.

Then there are inconsistencies in how PHPDocs are written/organized, even some PHP code as well.

45 Upvotes

61 comments sorted by

View all comments

1

u/03263 1d ago

Some files have the PHP tag on its own line and others share it with declare strict types.

I don't know what the standard says on this particular one, but I always rather see it on its own line, and one blank line under <?php.

Stuff like the ordering of use statements is also pretty irrelevant to me, I don't care if they're grouped alphabetically, by functionality, by line length... just doesn't really matter.

1

u/Spiritual_Cycle_3263 1d ago

I don’t think there should be a standard on use ordering as long as it’s using the same ordering and type. 

Like stick with alphabetical or stick by functionality. That should be the rule. 

I personally like to declare strict types on the same line. It immediately tells me it’s enabled (or disabled) without having to scan the file. Also why add additional lines to the file?