Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add the Symfony console #136

Merged
merged 1 commit into from
Jul 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ We will only merge pull requests that follow the project's coding style.

Please check your code with the provided PHP_CodeSniffer standard:

vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ Classes/ Tests/ Public/
vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ bin/ Classes/ Tests/ Public/

Please also check the code structure using PHPMD:

vendor/bin/phpmd Classes/ text Configuration/PHPMD/rules.xml

And also please run the static code analysis:

vendor/bin/phpstan analyse -l 5 Classes/ Tests/ Public/
vendor/bin/phpstan analyse -l 5 bin/ Classes/ Tests/ Public/

You can also run all code style checks using one long line from a bash shell:
find Classes/ Tests/ Public/ core/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l && vendor/bin/phpstan analyse -l 5 Classes/ Tests/ Public/ && vendor/bin/phpmd Classes/ text Configuration/PHPMD/rules.xml && vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ Classes/ Tests/ Public/
find Classes/ Tests/ Public/ core/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l && php -l bin/* && vendor/bin/phpstan analyse -l 5 bin/ Classes/ Tests/ Public/ && vendor/bin/phpmd Classes/ text Configuration/PHPMD/rules.xml && vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ bin/ Classes/ Tests/ Public/

This will execute all tests except for the unit tests and the integration
tests.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ script:
echo;
echo "Linting all PHP files";
find Classes/ Tests/ Public/ core/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l;
php -l bin/*;

- >
echo;
Expand All @@ -63,7 +64,7 @@ script:
- >
echo;
echo "Running the static analysis";
vendor/bin/phpstan analyse -l 5 Classes/ Tests/ Public/;
vendor/bin/phpstan analyse -l 5 bin/ Classes/ Tests/ Public/;

- >
echo;
Expand All @@ -73,4 +74,4 @@ script:
- >
echo;
echo "Running PHP_CodeSniffer";
vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ Classes/ Tests/ Public/;
vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ bin/ Classes/ Tests/ Public/;
26 changes: 26 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);

use PhpList\PhpList4\Core\ApplicationKernel;
use PhpList\PhpList4\Core\Bootstrap;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

set_time_limit(0);

require __DIR__ . '/../vendor/autoload.php';

$input = new ArgvInput();
$context = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $context !== 'prod';

if ($debug) {
Debug::enable();
}

Bootstrap::getInstance()->setApplicationContext($context)->configure();
$kernel = new ApplicationKernel($context, $debug);
$application = new Application($kernel);
$application->run($input);