php-language-server
php-language-server copied to clipboard
Difficulty installing and configuring on macOS 10.15.7
I'm working on an LSP client and would like to add preconfigured support for this language server. In the process I'm trying to develop end-user installation instructions.
Reading README.md
, the instructions say:
The recommended installation method is through [Composer](https://getcomposer.org/).
Simply run
composer require felixfbecker/language-server
When I attempt this, I get the following:
% composer require felixfbecker/language-server
Using version ^4.6 for felixfbecker/language-server
./composer.json has been updated
Running composer update felixfbecker/language-server
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- felixfbecker/language-server[v4.6.0, ..., v4.6.1] require squizlabs/php_codesniffer 3.0.0RC3 -> found squizlabs/php_codesniffer[3.0.0RC3] but it does not match your minimum-stability.
- felixfbecker/language-server[v4.6.2, ..., v4.6.4] require php ^7.0 -> your php version (8.0.2) does not satisfy that requirement.
- Root composer.json requires felixfbecker/language-server ^4.6 -> satisfiable by felixfbecker/language-server[v4.6.0, ..., v4.6.4].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
After much thrashing around, including rolling my installed PHP back to 7.4.15, I was able to do the following, which appears to have succeeded:
composer global config minimum-stability dev
composer global require felixfbecker/language-server -W
This may be worth a note in the README.
I then went to the next step in the instructions:
composer run-script --working-dir=vendor/felixfbecker/language-server parse-stubs
This failed, because vendor/felixfbecker/language-server
does not exist. The correct invocation appears to be:
composer run-script --working-dir=.composer/vendor/felixfbecker/language-server parse-stubs
(Using Composer 2.0.11 and PHP 7.4.15)
I'm not sure if that's a documentation issue or a Composer issue.
Finally, and here is where I am blocked:
siegel ~ % composer run-script --working-dir=.composer/vendor/felixfbecker/language-server parse-stubs
> LanguageServer\ComposerScripts::parseStubs
[...lots and lots of "Parsing file:////path/to/something.php" output, thenβ¦]
Parsing file:///Users/siegel/.composer/vendor/jetbrains/phpstorm-stubs/standard/standard_8.php
Script LanguageServer\ComposerScripts::parseStubs handling the parse-stubs event terminated with an exception
[RuntimeException]
A type is missing before a type separator
At this point I am unable to proceed further, and would appreciate any recommendations you may have.
Same for me
Composer 2.0.13 PHP 7.4.19 Mac 11.2.3 (big sur)
Removed http.php and standard_8.php - worked for me.
I think this is somehow related to php8?
same to me, Removed http.php and standard_8.php - worked for me.
For anyone finding this same issue, here's the source:
it's the result of using using the master
branch for the jetbrains/phpstorm-stubs
dependency here. Since it's using the branch directly (instead of a package version), Composer doesn't know that the master
branch now uses PHP 8 in that JetBrains repo. So the first PHP 8 syntax it sees (the spread operator: ...
) will cause the TypeError
you're seeing.
This project might be abandoned (don't see any activity in diffs for the last few years), so it's not likely that it'll get patched. To unblock yourself, you can just remove that file + it should complete building. (Though you might see other errors of the same type; continue ignoring those files.)
I agree the project seems to be abandoned; from what I can tell, folks have settled on Intelephense (and we've been recommending it).