Most voted "psr" questions
The PSR (PHP Standards Recommendation) are project specifications proposed by the PHP-FIG (PHP Framework Interop Group), a group composed of representatives of expressive PHP projects.
Learn more…7 questions
Sort by count of
-
5
votes1
answer319
viewsWhy does the PSR2 standard require us to use 4 (four) spaces instead of tab?
According to one of the items specified by the standard PSR2 (to which most PHP libraries), we have: Codes MUST use 4 spaces for indentation, not tabs. I know the pattern exists, but I’d like to…
-
5
votes2
answers154
viewsIs there a rule for "type statements in class properties"?
PHP 7.4 supports type declarations in class properties. In a normal routine I would use: /* @var array */ protected $names; Now in PHP 7.4 I can: protected array $names; But if I declare it this way…
-
4
votes1
answer619
viewsIs it correct to create a variable within an if?
it is correct to create a variable within an if ? In the code below you create a variable within the if, and avoid using the same filter twice. if($id = filter_input(INPUT_GET, 'id',…
-
1
votes1
answer458
viewsConfigure Namespace and autoload PSR-0
I am developing a project with the following structure: The goal is to make autoload load the classes. The archive autoload.php: function autoload($className) { $className = ltrim($className, '\\');…
-
1
votes1
answer43
viewsWhat is the correct order to inject dependencies into Laravel controllers?
I have noticed that sometimes, depending on the order I inject the dependencies, they don’t work... Is there any correct order?
-
0
votes0
answers1074
viewsConfiguring PHP Codesniffer in Vscode
I am unable to configure the phpcs extension in vscode. What I’ve already done I already downloaded and installed the Composer I installed the phpcs extension in vscode I’ve been trying to set this…
-
-1
votes0
answers9
viewsPHP Code Sniffer xml is ignoring the . dist file with rules
I’m using the package "squizlabs/php_codesniffer": "^3.6" to adjust my code using Code Sniffer in a project with Laravel 8. But my phpcs.xml.dist file is ignoring the rules defined without…