Thanks to visit codestin.com
Credit goes to github.com

Skip to content

StringResolver tries to instantiate Lexer without arguments #58840

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

Closed
MrDach opened this issue Nov 12, 2024 · 2 comments
Closed

StringResolver tries to instantiate Lexer without arguments #58840

MrDach opened this issue Nov 12, 2024 · 2 comments

Comments

@MrDach
Copy link

MrDach commented Nov 12, 2024

Symfony version(s) affected

7.1.6

Description

After running a composer update I'm getting the following exception:

ArgumentCountError {#243
  #message: "Too few arguments to function PHPStan\PhpDocParser\Lexer\Lexer::__construct(), 0 passed in /app/vendor/symfony/type-info/TypeResolver/StringTypeResolver.php on line 66 and exactly 1 expected"
  #code: 0
  #file: "/app/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php"
  #line: 102
  trace: {
    /app/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php:102 { …}
    /app/vendor/symfony/type-info/TypeResolver/StringTypeResolver.php:66 { …}
    /app/vendor/symfony/type-info/TypeResolver/TypeResolver.php:71 { …}
    /app/vendor/symfony/type-info/TypeResolver/TypeResolver.php:66 { …}
    /app/vendor/symfony/property-info/Extractor/ReflectionExtractor.php:102 { …}
    /app/var/cache/dev/ContainerI73EFVG/App_KernelDevDebugContainer.php:1019 {
      ContainerI73EFVG\App_KernelDevDebugContainer::getDebug_SerializerService($container)^
      › {
      ›     $a = ($container->privates['property_info.reflection_extractor'] ??= new \Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor());
      ›
    }
    /app/var/cache/dev/ContainerI73EFVG/getFetchCompanyDataCommandService.php:24 { …}
    /app/var/cache/dev/ContainerI73EFVG/App_KernelDevDebugContainer.php:411 { …}
    /app/vendor/symfony/dependency-injection/Container.php:390 { …}
    /app/vendor/symfony/dependency-injection/Argument/ServiceLocator.php:40 { …}
    /app/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php:40 { …}
    /app/vendor/symfony/console/Application.php:584 { …}
    /app/vendor/symfony/console/Application.php:669 { …}
    /app/vendor/symfony/framework-bundle/Console/Application.php:140 { …}
    /app/vendor/symfony/console/Application.php:258 { …}
    /app/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
    /app/vendor/symfony/console/Application.php:167 { …}
    /app/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
    /app/vendor/autoload_runtime.php:29 { …}
    /app/bin/console:15 { …}
  }
} 

From what I can gather this is due to phpstan/phpdoc-parser 2.0 being installed due to phpdocumentor/reflection-docblock v.5.6.0 being release which now supports phpdoc-parse 2.0. This no longer allows the Lexer to be instantiated with 0 arguments.

How to reproduce

Running composer update with this composer.json file and then trying to run a HTTP request or CLI command in Symfony.

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=8.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/dbal": "^4.2.1",
        "doctrine/doctrine-bundle": "*",
        "doctrine/doctrine-migrations-bundle": "^3.3.1",
        "doctrine/orm": "^3.3.0",
        "symfony/asset": "7.1.*",
        "symfony/asset-mapper": "7.1.*",
        "symfony/console": "7.1.*",
        "symfony/dotenv": "7.1.*",
        "symfony/flex": "^2",
        "symfony/framework-bundle": "7.1.*",
        "symfony/http-client": "7.1.*",
        "symfony/monolog-bundle": "^3.10",
        "symfony/property-access": "7.1.*",
        "symfony/runtime": "7.1.*",
        "symfony/serializer": "7.1.*",
        "symfony/twig-bundle": "7.1.*",
        "symfony/yaml": "7.1.*",
        "symfony/validator": "7.1.*",
        "symfonycasts/tailwind-bundle": "^0.6.0",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*",
        "symfony/polyfill-php82": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "importmap:install": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "7.1.*"
        }
    },
    "require-dev": {
        "psalm/plugin-symfony": "^5.2",
        "symfony/maker-bundle": "^1.60",
        "symfony/stopwatch": "7.1.*",
        "symfony/web-profiler-bundle": "7.1.*"
    }
}

Possible Solution

To avoid this issue for now I've added "phpdocumentor/reflection-docblock": "5.5.1" to my composer.json dev requirements.

Additional Context

No response

@stof
Copy link
Member

stof commented Nov 12, 2024

Duplicate of #58796

@stof stof marked this as a duplicate of #58796 Nov 12, 2024
@stof
Copy link
Member

stof commented Nov 12, 2024

This is already fixed in the dev version thanks to #58800 and #58804. The fix will be part of the next patch release.

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

No branches or pull requests

4 participants