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

Laravel v10 error in ArrayFile.php on line 84 #6

Open
Alexander-Kane opened this issue Sep 24, 2024 · 9 comments
Open

Laravel v10 error in ArrayFile.php on line 84 #6

Alexander-Kane opened this issue Sep 24, 2024 · 9 comments

Comments

@Alexander-Kane
Copy link

Laravel 10.48.20
PHP 8.1.9

Code:
$config = ArrayFile::open(base_path('config/app.php'));
Error:
PhpParser\Lexer\Emulative::__construct(): Argument #1 ($phpVersion) must be of type ?PhpParser\PhpVersion, array given, called in C:\OpenServer\domains\site.local\vendor\winter\laravel-config-writer\src\ArrayFile.php on line 84

@LukeTowers
Copy link
Member

@Alexander-Kane what version are you on?

@hoidream
Copy link

I also get the same error.

lavel 11 ..
nikic/php-parser:5.x error~

@LukeTowers
Copy link
Member

@hoidream what version of this library are you on?

@hoidream
Copy link

php: 8.2
laravel/framework: 11.9
nikic/php-parser : 5.2
Laravel Config Writer : 1.1.3

ArrayFile.php

$lexer = new Lexer\Emulative([
    'usedAttributes' => [
        'comments',
        'startTokenPos',
        'startLine',
        'endTokenPos',
        'endLine'
    ]
]);
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7, $lexer);

This problem occurs because nikic/php-parser 4.2 cannot be used.
Thanks!!!

@mjauvin
Copy link
Member

mjauvin commented Oct 11, 2024

Are you guys using the laravel-11-migration branch?

@mjauvin
Copy link
Member

mjauvin commented Oct 11, 2024

Please share the require section of your composer.json file

@hoidream
Copy link

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.2",
        "bacon/bacon-qr-code": "^3.0",
        "elasticsearch/elasticsearch": "^7",
        "erusev/parsedown-extra": "^0.8.1",
        "hhxsv5/laravel-s": "~3.8.0",
        "laravel/framework": "^11.9",
        "laravel/sanctum": "^4.0",
        "laravel/tinker": "^2.9",
        "nikic/php-parser": "^5.2",
        "picqer/php-barcode-generator": "^2.4",
        "pragmarx/google2fa-laravel": "^2.2",
        "winter/laravel-config-writer": "^1.1"
    },
    "require-dev": {
        "barryvdh/laravel-ide-helper": "^3.1",
        "fakerphp/faker": "^1.23",
        "laravel/pint": "^1.13",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.0",
        "phpunit/phpunit": "^11.0.1"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi",
            "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
            "@php artisan migrate --graceful --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}

Thank you for your interest!

@mjauvin
Copy link
Member

mjauvin commented Oct 11, 2024

Oh, so this is used outside of wintercms, ok.

@LukeTowers
Copy link
Member

@hoidream why can't nikic/php-parser 4.2 be used in your case? I believe there was some breaking changes in v5 that @jaxwilko might have to look at if we want to support it.

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

No branches or pull requests

4 participants