Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.5 breaks PHPStan #834

Closed
swiffer opened this issue Aug 29, 2020 · 10 comments · Fixed by #837
Closed

3.0.5 breaks PHPStan #834

swiffer opened this issue Aug 29, 2020 · 10 comments · Fixed by #837

Comments

@swiffer
Copy link

swiffer commented Aug 29, 2020

After upgrading to 3.0.5 I'm experiencing a lot of errors when running PHPStan


     Reflection error: ake\Http\BaseApplication not found.
     💡 Learn more at https://phpstan.org/user-guide/discovering-symbols


Line Command\ConsoleCommand.php


17 Syntax error, unexpected T_NAME_FULLY_QUALIFIED on line 17


@weirdan
Copy link

weirdan commented Aug 30, 2020

Also breaks vimeo/psalm and other packages using nikic/php-parser, on PHP 7.4. Have traced the problem to these lines:

if (false === defined('T_NAME_QUALIFIED')) {
/*
* PHP8 only token.
*/
define('T_NAME_QUALIFIED', -1);
define('T_NAME_FULLY_QUALIFIED', -1);
}

/cc @Arslanoov
Refs vimeo/psalm#4086

@DerManoMann
Copy link
Collaborator

Could I get some details about PHPStan version and the level you are using?
Just running phpstan analyse src does not report any errors for me on master.

@swiffer
Copy link
Author

swiffer commented Aug 31, 2020

I'm using the latest PHPStan in a Cake PHP project that has swagger-php installed as well.

I think it's not an issue when running against this project but within a project that has swagger-php as a dependency.

@DerManoMann
Copy link
Collaborator

Hmmm. Tricky; I guess without reproduction steps this will be hard to change.

@weirdan
Copy link

weirdan commented Aug 31, 2020

Repro repo

https://github.com/weirdan/parser-fail

Steps to reproduce

$ git clone git@github.com:weirdan/parser-fail.git
Cloning into 'parser-fail'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
Receiving objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 6 (delta 0), pack-reused 0

$ cd parser-fail

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 8 installs, 0 updates, 0 removals
  - Installing doctrine/lexer (1.2.1): Loading from cache
  - Installing nikic/php-parser (v4.9.1): Loading from cache
  - Installing symfony/deprecation-contracts (v2.1.3): Loading from cache
  - Installing symfony/polyfill-ctype (v1.18.1): Loading from cache
  - Installing symfony/yaml (v5.1.3): Loading from cache
  - Installing symfony/finder (v5.1.3): Loading from cache
  - Installing doctrine/annotations (1.10.4): Loading from cache
  - Installing zircote/swagger-php (3.0.5): Loading from cache
symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
Generating autoload files
5 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

$ vendor/bin/php-parse test.php
====> File test.php:
Syntax error, unexpected T_NAME_FULLY_QUALIFIED on line 2

Expected

$ vendor/bin/php-parse test.php
====> File test.php:
==> Node dump:
array(
    0: Stmt_Namespace(
        name: Name(
            parts: array(
                0: Weirdan
                1: ParserFail
            )
        )
        stmts: array(
        )
    )
)

Actual

$ vendor/bin/php-parse test.php
====> File test.php:
Syntax error, unexpected T_NAME_FULLY_QUALIFIED on line 2

@DerManoMann
Copy link
Collaborator

Funny, for some reason it doesn't like them both having the same value.

I can create a fix, but unfortunately I have no permission to update pacagist or create a release :/

@swiffer
Copy link
Author

swiffer commented Sep 2, 2020

🤔 still happening for me on dev-master

@weirdan
Copy link

weirdan commented Sep 2, 2020

You must be getting an old revision of dev-master, as the package on Packagist is not autoupdated:
image

@weirdan
Copy link

weirdan commented Sep 2, 2020

@swiffer doing pushd vendor/zircote/swagger-php; git pull --ff-only; popd should allow you to fix it locally so that you can verify the fix.

@swiffer
Copy link
Author

swiffer commented Sep 3, 2020

yes, now works fine - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants