I run psalm as a phar installed with phive. This means it is symlinked into [my project]/tools.
However when using the suggestion to run psalter I get the following error:
> phive install psalm
Phive 0.13.2 - Copyright (C) 2015-2020 by Arne Blankerts, Sebastian Heuer and Contributors
Linking /Users/mkroese/.phive/phars/psalm-3.8.2.phar to /Users/mkroese/git/proctorio/tools/psalm
> tools/psalm --version
Psalm 3.8.2@90d6b73fd8062432030ef39b7b6694b3902daa31
> tools/psalm --alter --issues=MissingParamType --dry-run
PHP Warning: include(): Failed opening 'psalter.php' for inclusion (include_path='.:/usr/local/Cellar/[email protected]/7.3.14/share/[email protected]/pear') in phar:///Users/mkroese/.phive/phars/psalm-3.8.2.phar/src/psalm.php on line 70
PHP Stack trace:
PHP 1. {main}() /Users/mkroese/.phive/phars/psalm-3.8.2.phar:0
PHP 2. require() /Users/mkroese/.phive/phars/psalm-3.8.2.phar:14
PHP 3. require_once() phar:///Users/mkroese/.phive/phars/psalm-3.8.2.phar/psalm:5
Warning: include(): Failed opening 'psalter.php' for inclusion (include_path='.:/usr/local/Cellar/[email protected]/7.3.14/share/[email protected]/pear') in phar:///Users/mkroese/.phive/phars/psalm-3.8.2.phar/src/psalm.php on line 70
Call Stack:
0.0042 393432 1. {main}() /Users/mkroese/.phive/phars/psalm-3.8.2.phar:0
0.0584 1368816 2. require('phar:///Users/mkroese/.phive/phars/psalm-3.8.2.phar/psalm') /Users/mkroese/.phive/phars/psalm-3.8.2.phar:14
0.0596 1471392 3. require_once('phar:///Users/mkroese/.phive/phars/psalm-3.8.2.phar/src/psalm.php') phar:///Users/mkroese/.phive/phars/psalm-3.8.2.phar/psalm:5
I run macOS 10.14.6, php 7.3.14 (via homebrew)
I have no issues when running the same version as a composer dev-dependency
Hey @webmaster777, can you reproduce the issue on https://psalm.dev ?
I couldn't reproduce this:
$ ./phive install [email protected]
Phive 0.13.2 - Copyright (C) 2015-2020 by Arne Blankerts, Sebastian Heuer and Contributors
Linking /home/weirdan/.phive/phars/psalm-3.8.2.phar to /home/weirdan/src/t/tools/psalm
$ tools/psalm
Scanning files...
Analyzing files...
I
INFO: MissingParamType - src/T.php:3:30 - Parameter $s has no provided type
public static function foo($s) : void {
------------------------------
No errors found!
------------------------------
1 other issues found.
You can hide them with --show-info=false
------------------------------
Psalm can automatically fix 1 issues.
Run Psalm again with
--alter --issues=MissingParamType --dry-run
to see what it can fix.
------------------------------
Checks took 0.15 seconds and used 28.473MB of memory
Psalm was able to infer types for 0.0000% of the codebase
$ tools/psalm --alter --issues=MissingParamType --dry-run
Scanning files...
Analyzing files...
β
Altering files...
/home/weirdan/src/t/src/T.php:
--- /home/weirdan/src/t/src/T.php
+++ /home/weirdan/src/t/src/T.php
@@ -1,6 +1,6 @@
<?php
class C {
- public static function foo($s) : void {
+ public static function foo(string $s) : void {
echo $s;
}
}
------------------------------
No errors found!
------------------------------
Checks took 0.16 seconds and used 28.464MB of memory
Psalm was able to infer types for 0.0000% of the codebase
Maybe using absolute path (include __DIR__ . '/psalter.php') here: https://github.com/vimeo/psalm/blob/2a0dd48dcd2d0b06c13a2f4eb3ff5953e48f0d87/src/psalm.php#L83
would fix the issue.
I've updated my original comment to show the versions of phive and psalm, and my os and php version.
I've implemented the fix @weirdan suggested, please let me know if it doesn't work.
Nope.
tools/psalm --alter --issues=MissingParamType --dry-run
PHP Warning: include(): Failed opening 'psalter.php' for inclusion (include_path='.:/usr/local/Cellar/[email protected]/7.3.14/share/[email protected]/pear') in phar:///Users/mkroese/.phive/phars/psalm-3.8.3.phar/src/psalm.php on line 71
PHP Stack trace:
PHP 1. {main}() /Users/mkroese/.phive/phars/psalm-3.8.3.phar:0
PHP 2. require() /Users/mkroese/.phive/phars/psalm-3.8.3.phar:14
PHP 3. require_once() phar:///Users/mkroese/.phive/phars/psalm-3.8.3.phar/psalm:5
Warning: include(): Failed opening 'psalter.php' for inclusion (include_path='.:/usr/local/Cellar/[email protected]/7.3.14/share/[email protected]/pear') in phar:///Users/mkroese/.phive/phars/psalm-3.8.3.phar/src/psalm.php on line 71
Call Stack:
0.0060 393432 1. {main}() /Users/mkroese/.phive/phars/psalm-3.8.3.phar:0
0.0858 1369560 2. require('phar:///Users/mkroese/.phive/phars/psalm-3.8.3.phar/psalm') /Users/mkroese/.phive/phars/psalm-3.8.3.phar:14
0.0868 1476592 3. require_once('phar:///Users/mkroese/.phive/phars/psalm-3.8.3.phar/src/psalm.php') phar:///Users/mkroese/.phive/phars/psalm-3.8.3.phar/psalm:5
using __DIR__ inside a phar does not do what you think it does.
Can this be reopened?
Are you sure youβre using latest master?
It looks like Travis stopped building new phars five days ago - investigating
Not sure how to get a master phar? Is there any guidance on this matter?
Not sure how to get a master phar? Is there any guidance on this matter?
You can build one yourself: clone the repo, do composer install followed by ./bin/build-phar.sh. The resulting phar file will be placed into build folder.
Psalm used to have phar built by travis on every commit, but apparently it's broken.
I've build the phar from source, and that does indeed work, even when symlinked.
> tools/psalm --alter --issues=MissingParamType --dry-run
Scanning files...
Analyzing files...
ββββββββββ
Altering files...
------------------------------
No errors found!
------------------------------
Checks took 0.35 seconds and used 32.658MB of memory
Psalm was able to infer types for 98.3607% of the codebase
> tools/psalm --version
Psalm 3.x-dev@d99f23eb45d99bd55346c79346b9ccd5df65330c
Also, phive was now able to update with the new published phar:
> tools/psalm --version
Psalm 3.8.5@e6ec5fa22a7b9e61670a24d07b3119aff80dcd89
> tools/psalm --alter --issues=MissingParamType --dry-run
Scanning files...
Analyzing files...
ββββββββββ
Altering files...
------------------------------
No errors found!
------------------------------
Checks took 0.43 seconds and used 32.152MB of memory
Psalm was able to infer types for 98.3607% of the codebase
The release 3.8.5 should work for you