Questions tagged as 'psr'

1
answer

Why 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 of the PHP libraries), we have: Codes MUST use 4 indentation spaces, not tabs. I know the pattern exists, but I wonder if there is any special reason. What i...
asked by 01.02.2016 / 18:41
1
answer

Is it correct to create a variable within an if?

Is it correct to create a variable within an if? In the code below, you create a variable inside the if, and avoid using the same filter twice. if($id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT)): /* Código */ endif; What do...
asked by 06.04.2016 / 22:02
1
answer

Configure Namespace and autoload PSR-0

I am developing a project with the following structure: Thegoalistomakeautoloadloadtheclasses.Theautoload.phpfile:functionautoload($className){$className=ltrim($className,'\');$fileName='';$namespace='';if($lastNsPos=strrpos($className,'\')){$n...
asked by 11.10.2016 / 14:21
1
answer

What is the correct order to inject dependencies in Laravel controllers?

I have noticed that sometimes, depending on the order that I inject the dependencies, they do not work ... Is there a correct order?     
asked by 09.02.2018 / 01:49
0
answers

Autoload composer does not work

Good morning! I do not know what to do, my Composer autoload not work at all ... The error I get is always Uncaught Error: Class 'App\Lucass\Fazendo' not found in /var/www/projetos/teste/index.php on line 6' not found Follow my f...
asked by 17.04.2018 / 15:42