PHPCheckstyle/phpcheckstyle

Could not open input file: vendor/bin/run.php

lsv opened this issue · 4 comments

lsv commented

Installed with

composer require phpcheckstyle/phpcheckstyle --dev

Installed version V0.14.7

Running vendor/bin/phpcheckstyle or vendor/bin/phpcheckstyle -h

Recieved: Could not open input file: vendor/bin/run.php

Changed version to dev-master - using commit 12794c0

Same error

Hi,

I will have a look as soon as I can.

OK, there might be a problem with the Composer post-install script.

When I run composer require phpcheckstyle/phpcheckstyle --dev in a VM, I get a script that is created by composer in /vendor/bin that looks like this :

#!/usr/bin/env sh

dir=$(d=${0%[/\\]*}; cd "$d" > /dev/null; cd '../phpcheckstyle/phpcheckstyle' && pwd)

# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
        # Cygwin paths start with /cygdrive/ which will break windows PHP,
        # so we need to translate the dir path to windows format. However
        # we could be using cygwin PHP which does not require this, so we
        # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
        if [[ $(which php) == /cygdrive/* ]]; then
                dir=$(cygpath -m "$dir");
        fi
fi

dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/phpcheckstyle" "$@"

And it works on my debian VM.

But the post-install script that I have listed looks like that :

BASEDIR=$(dirname "$0")

php $BASEDIR/../../run.php

And I was missing the ../.., which could have caused the error you describe.

What is your OS ? Can you tell me what does the /vendor/bin/phpcheckstyle script looks like after install ?

I'm not a specialist in Composer config.

Otherwise, you can always call directly the run.php file.

Hello!

Just got the issue in a project:

$ vendor/bin/phpcheckstyle --src ./module ...
Could not open input file: vendor/bin/run.php

The file .../vendor/bin/phpcheckstyle looks like this:

BASEDIR=$(dirname "$0")

php $BASEDIR/run.php "$@"

The file run.php is there:

$ find ./ -name "run.php"
./vendor/phpcheckstyle/phpcheckstyle/run.php

Workaround:

$ vendor/phpcheckstyle/phpcheckstyle/phpcheckstyle --src ./module ...

Hello ! Thanks for the workaround ^^

I'll check if I can do something in my box.