Skip to content

Commit

Permalink
Fix process builder
Browse files Browse the repository at this point in the history
  • Loading branch information
bruli committed Dec 7, 2017
1 parent bced3b5 commit e05d223
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ php-git-hooks.yml
var/cache
var/logs
.php_cs.cache

###> friendsofphp/php-cs-fixer ###
.php_cs
.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> phpunit/phpunit ###
/phpunit.xml
###< phpunit/phpunit ###
/.php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PhpGitHooks\Infrastructure\Tool\ToolPathFinder;
use PhpGitHooks\Module\PhpCs\Model\PhpCsToolProcessorInterface;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;

class PhpCsToolProcessor implements PhpCsToolProcessorInterface
{
Expand Down Expand Up @@ -47,7 +46,7 @@ public function process($file, $standard, $ignore)
*/
private function execute($file, $standard, $ignore)
{
$processBuilder = new ProcessBuilder(
$process = new Process(
[
'php',
$this->toolPathFinder->find('phpcs'),
Expand All @@ -57,7 +56,6 @@ private function execute($file, $standard, $ignore)
]
);

$process = $processBuilder->getProcess();
$process->run();

return $process;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PhpGitHooks\Infrastructure\Tool\ToolPathFinder;
use PhpGitHooks\Module\PhpCsFixer\Model\PhpCsFixerToolProcessorInterface;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;

class PhpCsFixerToolProcessor implements PhpCsFixerToolProcessorInterface
{
Expand Down Expand Up @@ -60,9 +59,8 @@ private function processTool($file, $level, $options)
$arguments = array_merge($arguments, explode(' ', trim($options)));
}

$processBuilder = new ProcessBuilder($arguments);
$process = new Process($arguments);

$process = $processBuilder->getProcess();
$process->run();

return $process;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use PhpGitHooks\Module\PhpLint\Model\PhpLintToolProcessorInterface;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;

class PhpLintToolProcessor implements PhpLintToolProcessorInterface
{
Expand All @@ -27,15 +26,14 @@ public function process($file)
*/
private function execute($file)
{
$processBuilder = new ProcessBuilder(
$process = new Process(
[
'php',
'-l',
$file,
]
);

$process = $processBuilder->getProcess();
$process->run();

return $process;
Expand Down
243 changes: 243 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,248 @@
{
"beberlei/assert": {
"version": "v2.8.1"
},
"bruli/event-bus-bundle": {
"version": "0.4"
},
"bruli/ignore-files": {
"version": "1.0.1"
},
"bruli/php-value-objects": {
"version": "v0.4"
},
"composer/ca-bundle": {
"version": "1.1.0"
},
"composer/composer": {
"version": "1.5.5"
},
"composer/semver": {
"version": "1.4.2"
},
"composer/spdx-licenses": {
"version": "1.1.6"
},
"doctrine/annotations": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672"
}
},
"doctrine/instantiator": {
"version": "1.1.0"
},
"doctrine/lexer": {
"version": "v1.0.1"
},
"fiunchinho/phpunit-randomizer": {
"version": "v3.0.0"
},
"friendsofphp/php-cs-fixer": {
"version": "2.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.2",
"ref": "9d60c231a92e69c68b89897813ec4931d0697b1f"
}
},
"fzaninotto/faker": {
"version": "v1.7.1"
},
"gecko-packages/gecko-php-unit": {
"version": "v3.0"
},
"hamcrest/hamcrest-php": {
"version": "v1.2.2"
},
"justinrainbow/json-schema": {
"version": "5.2.6"
},
"mockery/mockery": {
"version": "0.9.9"
},
"myclabs/deep-copy": {
"version": "1.7.0"
},
"paragonie/random_compat": {
"version": "v2.0.11"
},
"pdepend/pdepend": {
"version": "2.5.1"
},
"phar-io/manifest": {
"version": "1.0.1"
},
"phar-io/version": {
"version": "1.0.1"
},
"php-cs-fixer/diff": {
"version": "v1.2.0"
},
"phpdocumentor/reflection-common": {
"version": "1.0.1"
},
"phpdocumentor/reflection-docblock": {
"version": "4.2.0"
},
"phpdocumentor/type-resolver": {
"version": "0.4.0"
},
"phpmd/phpmd": {
"version": "2.6.0"
},
"phpspec/prophecy": {
"version": "1.7.3"
},
"phpunit/php-code-coverage": {
"version": "5.3.0"
},
"phpunit/php-file-iterator": {
"version": "1.4.5"
},
"phpunit/php-text-template": {
"version": "1.2.1"
},
"phpunit/php-timer": {
"version": "1.0.9"
},
"phpunit/php-token-stream": {
"version": "2.0.2"
},
"phpunit/phpunit": {
"version": "4.7",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.7",
"ref": "fc35828893288f0bb786291377433ee8d7e14738"
}
},
"phpunit/phpunit-mock-objects": {
"version": "5.0.4"
},
"psr/container": {
"version": "1.0.0"
},
"psr/log": {
"version": "1.0.2"
},
"sebastian/code-unit-reverse-lookup": {
"version": "1.0.1"
},
"sebastian/comparator": {
"version": "2.1.0"
},
"sebastian/diff": {
"version": "2.0.1"
},
"sebastian/environment": {
"version": "3.1.0"
},
"sebastian/exporter": {
"version": "3.1.0"
},
"sebastian/global-state": {
"version": "2.0.0"
},
"sebastian/object-enumerator": {
"version": "3.0.3"
},
"sebastian/object-reflector": {
"version": "1.1.1"
},
"sebastian/recursion-context": {
"version": "3.0.0"
},
"sebastian/resource-operations": {
"version": "1.0.0"
},
"sebastian/version": {
"version": "2.0.1"
},
"seld/cli-prompt": {
"version": "1.0.3"
},
"seld/jsonlint": {
"version": "1.6.2"
},
"seld/phar-utils": {
"version": "1.0.1"
},
"squizlabs/php_codesniffer": {
"version": "2.9.1"
},
"symfony/config": {
"version": "v4.0.1"
},
"symfony/console": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "9f94d3ea453cd8a3b95db7f82592d7344fe3a76a"
}
},
"symfony/debug": {
"version": "v4.0.1"
},
"symfony/dependency-injection": {
"version": "v4.0.1"
},
"symfony/event-dispatcher": {
"version": "v4.0.1"
},
"symfony/filesystem": {
"version": "v3.4.1"
},
"symfony/finder": {
"version": "v3.4.1"
},
"symfony/flex": {
"version": "v1.0.46"
},
"symfony/http-foundation": {
"version": "v4.0.1"
},
"symfony/http-kernel": {
"version": "v4.0.1"
},
"symfony/intl": {
"version": "v3.4.1"
},
"symfony/options-resolver": {
"version": "v4.0.1"
},
"symfony/polyfill-intl-icu": {
"version": "v1.6.0"
},
"symfony/polyfill-mbstring": {
"version": "v1.6.0"
},
"symfony/polyfill-php70": {
"version": "v1.6.0"
},
"symfony/polyfill-php72": {
"version": "v1.6.0"
},
"symfony/process": {
"version": "v3.4.1"
},
"symfony/stopwatch": {
"version": "v4.0.1"
},
"symfony/yaml": {
"version": "v4.0.1"
},
"theseer/tokenizer": {
"version": "1.1.0"
},
"webmozart/assert": {
"version": "1.2.0"
}
}

0 comments on commit e05d223

Please sign in to comment.