Bug in relative path for phar file
dereuromark opened this issue · 8 comments
Before recent changes, this phpstan.neon file inside /tests folder was valid:
parameters:
autoload_files:
- tests/bootstrap.php
There is also a tests/bootstrap.php file
This is running here:
php phpstan.phar analyse -c tests/phpstan.neon -l 1 src/
This was all working for months.
But now on travis this errors with:
Script returned with error code 1
Autoload file /home/travis/build/.../tests/tests/bootstrap.php does not exist.
It also still is working locally, with exactly the same downloaded file.
So it must be some weird issue on the PHP version on travis (php5.6) together with the phar file.
It should not duplicate the tests folder, but instead use the defined file above relative from the cwd.
What version are you running in Travis?
The dev-master changes how relative paths are resolved in neon config files - they are relative to the position of the file, not to the current working directory. But that's not in a stable version yet.
https://travis-ci.org/dereuromark/cakephp-sandbox/builds
You can see the regression between
- OK ( about a month ago) - https://travis-ci.org/dereuromark/cakephp-sandbox/jobs/584194081
- failed (about 5 hours ago) - https://travis-ci.org/dereuromark/cakephp-sandbox/jobs/600829888
(checks run)
Unfortunately, phpstan does not report the version downloaded/run here.
wget https://github.com/phpstan/phpstan-shim/raw/master/phpstan.phar
Location: https://raw.githubusercontent.com/phpstan/phpstan-shim/master/phpstan.phar
Yes, you definitely should not use master from phpstan-shim, that's dev-master. Download a stable version instead, like https://github.com/phpstan/phpstan/releases/download/0.11.18/phpstan.phar.
I understand that it is under development. That said, it should still behave correctly, since it will soon become released. Early checking here is actually also a good thing before tagging sth you can't take back anymore.
oh :( That does not sound like a good change. That is not how it should be IMO, as all files and paths should be relative from cwd, as also usually all other tools handle such things.
But this issue aside, there must still be some bug, since locally, the same 0.12.x-dev@364d9ba works with the cwd relative path. So behavior is quite different here from local to travis, both being linux versions.
Now the resolving is predictable, see phpstan/phpstan#662
Try newer build, yours is from September 8th.