nikic / PHP-Parser

A PHP parser written in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

5.0.0 - Call to undefined method PhpParser\ParserFactory::createForHostVersion()

MatthewBooth opened this issue · comments

I'm using the Symfony PHPUnit Bridge functionality and my unit tests now fail on the titular method call, which from what I can tell should've already been part of v4.18.0

I can confirm the method exists in the code base here.

The error I'm facing:

Call to undefined method PhpParser\ParserFactory::createForHostVersion()

I think that the error is rather related to how the Symfony PHPUnit bridge bootstraps your tests (my guess is that you have a (transient) dependency on 4.18 while the bridge installs 5.0). Can you please open an issue in the Symfony repository instead?

I think that the error is rather related to how the Symfony PHPUnit bridge bootstraps your tests (my guess is that you have a (transient) dependency on 4.18 while the bridge installs 5.0). Can you please open an issue in the Symfony repository instead?

I will open an issue there instead :)

From what I can tell, we've not got any dependencies on 4.18.0 or 5.0.0, it's something the phpunit bridge installs.

It's run like:

php bin/phpunit         
#No composer.json found in the current directory, showing available packages from packagist.org
Creating a "phpunit/phpunit" project at "./phpunit-9.5-0"
Installing phpunit/phpunit (9.5.28)
Plugins have been disabled.
  - Installing phpunit/phpunit (9.5.28): Extracting archive
Created project in /var/www/html/bin/.phpunit/phpunit-9.5-0
composer.json has been updated
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 28 installs, 0 updates, 0 removals
  - Locking doctrine/instantiator (2.0.0)
  - Locking myclabs/deep-copy (1.11.1)
  - Locking nikic/php-parser (v5.0.0)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpunit/php-code-coverage (9.2.30)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.8)
  - Locking sebastian/complexity (2.0.3)
  - Locking sebastian/diff (4.0.5)
  - Locking sebastian/environment (5.1.5)
  - Locking sebastian/exporter (4.0.5)
  - Locking sebastian/global-state (5.0.6)
  - Locking sebastian/lines-of-code (1.0.4)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.5)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.2.1)
  - Locking sebastian/version (3.0.2)
  - Locking symfony/phpunit-bridge (9.5.99)
  - Locking theseer/tokenizer (1.2.2)
Writing lock file
Installing dependencies from lock file
Package operations: 28 installs, 0 updates, 0 removals
  - Installing doctrine/instantiator (2.0.0): Extracting archive
  - Installing myclabs/deep-copy (1.11.1): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing theseer/tokenizer (1.2.2): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing nikic/php-parser (v5.0.0): Extracting archive
  - Installing sebastian/lines-of-code (1.0.4): Extracting archive
  - Installing sebastian/environment (5.1.5): Extracting archive
  - Installing sebastian/complexity (2.0.3): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.30): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/recursion-context (4.0.5): Extracting archive
  - Installing sebastian/exporter (4.0.5): Extracting archive
  - Installing sebastian/diff (4.0.5): Extracting archive
  - Installing sebastian/comparator (4.0.8): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.6): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/type (3.2.1): Extracting archive
  - Installing symfony/phpunit-bridge (9.5.99): Symlinking from ../../../vendor/symfony/phpunit-bridge
3 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
24 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

There's a few version differences between our last build on the 21st December 2023 but the major one is v5.0.0 for this repository. We don't, unfortuntely, have control over these composer requirements as they come straight from the phpunit-brdige functionality.

Anyway, thanks for replying, I'll open a ticket there.