laravel/tinker

Parse error: Syntax error, unexpected ':' in vendor\psy\psysh\src\Exception\ParseErrorException.php on line 40.

itsrexb opened this issue · 1 comments

  • Tinker Version: 2.7
  • Laravel Version: 9.44
  • PHP Version: 8.1
  • Database Driver & Version: MongoDB 1.15

Good day!
I encountered this only on windows and not in Unix.
Thank you

PS D:\www\backend> php artisan tinker -vv
Psy Shell v0.11.9 (PHP 8.1.12 — cli) by Justin Hileman
> \App\Models\User:first()

   PARSE ERROR  PHP Parse error: Syntax error, unexpected ':' in vendor\psy\psysh\src\Exception\ParseErrorException.php on line 40.

--
 <class></class>() at vendor\psy\psysh\src\Exception\ParseErrorException.php:40
 <class>Psy\Exception\ParseErrorException</class>::fromParseError() at vendor\psy\psysh\src\CodeCleaner.php:340
 <class>Psy\CodeCleaner</class>->parse() at vendor\psy\psysh\src\CodeCleaner.php:267
 <class>Psy\CodeCleaner</class>->clean() at vendor\psy\psysh\src\Shell.php:866
 <class>Psy\Shell</class>->addCode() at vendor\psy\psysh\src\Shell.php:549
 <class>Psy\Shell</class>->getInput() at vendor\psy\psysh\src\ExecutionLoopClosure.php:40
 <class></class>Psy\{closure}() at vendor\psy\psysh\src\ExecutionClosure.php:89
 <class>Psy\ExecutionClosure</class>->execute() at vendor\psy\psysh\src\Shell.php:395
 <class>Psy\Shell</class>->doInteractiveRun() at vendor\psy\psysh\src\Shell.php:366
 <class>Psy\Shell</class>->doRun() at vendor\symfony\console\Application.php:168
 <class>Symfony\Component\Console\Application</class>->run() at vendor\psy\psysh\src\Shell.php:341
 <class>Psy\Shell</class>->run() at vendor\laravel\tinker\src\Console\TinkerCommand.php:85
 <class>Laravel\Tinker\Console\TinkerCommand</class>->handle() at vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
 <class>Illuminate\Container\BoundMethod</class>::Illuminate\Container\{closure}() at vendor\laravel\framework\src\Illuminate\Container\Util.php:41
 <class>Illuminate\Container\Util</class>::unwrapIfClosure() at vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:93
 <class>Illuminate\Container\BoundMethod</class>::callBoundMethod() at vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:37
 <class>Illuminate\Container\BoundMethod</class>::call() at vendor\laravel\framework\src\Illuminate\Container\Container.php:651
 <class>Illuminate\Container\Container</class>->call() at vendor\laravel\framework\src\Illuminate\Console\Command.php:182
 <class>Illuminate\Console\Command</class>->execute() at vendor\symfony\console\Command\Command.php:312
 <class>Symfony\Component\Console\Command\Command</class>->run() at vendor\laravel\framework\src\Illuminate\Console\Command.php:152
 <class>Illuminate\Console\Command</class>->run() at vendor\symfony\console\Application.php:1022
 <class>Symfony\Component\Console\Application</class>->doRunCommand() at vendor\symfony\console\Application.php:314
 <class>Symfony\Component\Console\Application</class>->doRun() at vendor\symfony\console\Application.php:168
 <class>Symfony\Component\Console\Application</class>->run() at vendor\laravel\framework\src\Illuminate\Console\Application.php:102
 <class>Illuminate\Console\Application</class>->run() at vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:155
 <class>Illuminate\Foundation\Console\Kernel</class>->handle() at artisan:37

>   

My composer:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/itsrexb/laravel-google-translate.git"
        },
        {
            "type": "vcs",
            "url": "https://github.com/itsrexb/php-shopify.git"
        },
        {
            "type": "vcs",
            "url": "https://github.com/itsrexb/laravel-mongodb-session.git"
        }
    ],
    "require": {
        "php": "^8.1",
        "aws/aws-sdk-php-laravel": "^3.7",
        "ckfinder/ckfinder-laravel-package": "^4.0",
        "consoletvs/charts": "^6.5",
        "fabpot/goutte": "^4.0",
        "fruitcake/laravel-cors": "^3.0",
        "intervention/image": "^2.7",
        "jenssegers/mongodb": "*",
        "laravel/framework": "^9.44",
        "laravel/legacy-factories": "^1.3",
        "laravel/sanctum": "^3.0",
        "laravel/socialite": "^5.5",
        "laravel/tinker": "^2.7",
        "laravel/ui": "^4.1",
        "laraveldaily/laravel-invoices": "^3.0",
        "league/flysystem-aws-s3-v3": "^3.10",
        "rollbar/rollbar": "^3.1",
        "rollbar/rollbar-laravel": "^7.2",
        "simplesoftwareio/simple-qrcode": "^4.2",
        "spatie/db-dumper": "^3.3",
        "spatie/laravel-backup": "^8.1",
        "symfony/http-client": "^6.2",
        "symfony/postmark-mailer": "^6.2",
        "symfony/psr-http-message-bridge": "^2.1"
    },
    "require-dev": {
        "tanmuhittin/laravel-google-translate": "master",
        "phpclassic/php-shopify": "master",
        "jenssegers/mongodb-session": "master"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan clear-compiled",
            "@php artisan queue:restart"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "authors": [
        {
            "name": "Rex Bengil",
            "email": "centraleffects@yahoo.com"
        }
    ]
}

You probably meant \ App\Models\User::first()?