add phpstan and fix few php-cs-fixer

This commit is contained in:
osaajani 2019-10-29 18:34:17 +01:00
parent cf1746ff13
commit d3408e0600
3 changed files with 44 additions and 1 deletions

View File

@ -7,7 +7,7 @@
'Args :' . "\n" .
' - help : Show help message.' . "\n" .
' - lint : Show coding standards to fix.' . "\n" .
' - help : Fix coding standards.' . "\n";
' - fix : Fix coding standards.' . "\n";
exit(100);
}

BIN
tests/phpstan/phpstan.phar Executable file

Binary file not shown.

43
tests/phpstan/run.php Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/php
<?php
function help ()
{
echo 'Usage : ' . __FILE__ . ' <arg>' . "\n" .
'Args :' . "\n" .
' - help : Show help message.' . "\n" .
' - analyse : Analyse code with phpstan.' . "\n";
exit(100);
}
$analyse_commands = [
'php ' . __DIR__ . '/phpstan.phar analyse --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../controllers/',
'php ' . __DIR__ . '/phpstan.phar analyse --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../models/',
];
if (count($argv) < 2 || $argv[1] === 'help')
{
help();
}
if ($argv[1] === 'analyse')
{
echo "######################" . "\n";
echo "# SHOW ERRORS TO FIX #" . "\n";
echo "######################" . "\n";
echo "\n";
foreach ($analyse_commands as $analyse_command)
{
echo "Run : " . $analyse_command . " \n";
$return = shell_exec($analyse_command);
echo $return;
echo "\n\n";
}
exit(0);
}
echo "Invalid arg : " . $argv[1] . "\n";
help();