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

phpcsfixer ProcessUtils::escapeArgument() error #606

Closed
bastos71 opened this issue Mar 4, 2019 · 0 comments
Closed

phpcsfixer ProcessUtils::escapeArgument() error #606

bastos71 opened this issue Mar 4, 2019 · 0 comments

Comments

@bastos71
Copy link
Contributor

bastos71 commented Mar 4, 2019

Q A
Version 0.15.0
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets None

Seems like ProcessUtils::escapeArgument is too strict and cannot convert an input file into an absolute path, resulting into a Fatal Error when using phpcsfixer task.

My configuration

parameters:
    git_dir: .
    bin_dir: ./vendor/bin
    hooks_preset: vagrant
    process_timeout: 300
    ascii:
        failed: ~
        succeeded: ~
    tasks:
        phpcsfixer:
            metadata:
                priority: 100                

Steps to reproduce:

# Generate empty folder
mkdir tmp
cd tmp
git init
echo "vendor" > .gitignore
pbpaste > grumphp.yml
composer require phpro/grumphp 0.15.0
composer require friendsofphp/php-cs-fixer

echo "<?php /** This is a sample PHP File */" > sample.php

# Run GrumpHP:
./vendor/bin/grumphp run

Result:

GrumPHP is sniffing your code!
Running task 1/1: PhpCsFixer... PHP Fatal error:  Uncaught TypeError: Argument 1 passed to GrumPHP\Process\ProcessUtils::escapeArgument() must be of the type string, object given, called in /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessFactory.php on line 20 and defined in /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessUtils.php:31
Stack trace:
#0 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessFactory.php(20): GrumPHP\Process\ProcessUtils::escapeArgument(Object(Symfony\Component\Finder\SplFileInfo))
#1 [internal function]: GrumPHP\Process\ProcessFactory::GrumPHP\Process\{closure}(Object(Symfony\Component\Finder\SplFileInfo))
#2 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessFactory.php(21): array_map(Object(Closure), Array)
#3 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessBuilder.php(40): GrumPHP\Process\ProcessFactory::fromArguments(Object(GrumPHP\Collection\ProcessArgumentsCollection))
#4 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Task/AbstractPhpCsFixe in /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessUtils.php on line 31

Fatal error: Uncaught TypeError: Argument 1 passed to GrumPHP\Process\ProcessUtils::escapeArgument() must be of the type string, object given, called in /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessFactory.php on line 20 and defined in /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessUtils.php:31
Stack trace:
#0 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessFactory.php(20): GrumPHP\Process\ProcessUtils::escapeArgument(Object(Symfony\Component\Finder\SplFileInfo))
#1 [internal function]: GrumPHP\Process\ProcessFactory::GrumPHP\Process\{closure}(Object(Symfony\Component\Finder\SplFileInfo))
#2 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessFactory.php(21): array_map(Object(Closure), Array)
#3 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessBuilder.php(40): GrumPHP\Process\ProcessFactory::fromArguments(Object(GrumPHP\Collection\ProcessArgumentsCollection))
#4 /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Task/AbstractPhpCsFixe in /var/www/_tmp/grumphp/tmp/vendor/phpro/grumphp/src/Process/ProcessUtils.php on line 31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant