Parse error: 语法错误,意外的 ‘|,期望变量 (T_VARIABLE)。

huangapple go评论61阅读模式
英文:

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE)

问题

I got the error message When I Hosting "laravel project" what should I do?
The error message is

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /home/vol18_2/epizy.com/epiz_34191254/htdocs/BCM_Bank/vendor/nunomaduro/termwind/src/Functions.php on line 17

My Composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "carbondate/carbon": "*",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/breeze": "^1.20",
        "laravel/framework": "^10.8",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "livewire/livewire": "^2.12",
        "simplesoftwareio/simple-qrcode": "^4.2"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },
    "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"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
         "platform": {
            "php": "8.1"
         },
        "platform-check": false,
        "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
}

The error file Functions.php

<?php

declare(strict_types=1);

namespace Termwind;

use Closure;
use Symfony\Component\Console\Output\OutputInterface;
use Termwind\Repositories\Styles as StyleRepository;
use Termwind\ValueObjects\Style;
use Termwind\ValueObjects\Styles;

if (! function_exists('Termwind\renderUsing')) {
    /**
     * Sets the renderer implementation.
     */
    function renderUsing(OutputInterface|null $renderer): void
    {
        Termwind::renderUsing($renderer);
    }
}

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /home/vol18_2/epizy.com/epiz_34191254/htdocs/BCM_Bank/vendor/nunomaduro/termwind/src/Functions.php on line 17

英文:

I got the error message When I Hosting <a href="http://yannaing.42web.io/">laravel project</a> what should I do ?
The error message is

Parse error: syntax error, unexpected &#39;|&#39;, expecting variable (T_VARIABLE) in /home/vol18_2/epizy.com/epiz_34191254/htdocs/BCM_Bank/vendor/nunomaduro/termwind/src/Functions.php on line 17

My Composer.json

{
    &quot;name&quot;: &quot;laravel/laravel&quot;,
    &quot;type&quot;: &quot;project&quot;,
    &quot;description&quot;: &quot;The Laravel Framework.&quot;,
    &quot;keywords&quot;: [&quot;framework&quot;, &quot;laravel&quot;],
    &quot;license&quot;: &quot;MIT&quot;,
    &quot;require&quot;: {
        &quot;php&quot;: &quot;^8.1&quot;,
        &quot;carbondate/carbon&quot;: &quot;*&quot;,
        &quot;guzzlehttp/guzzle&quot;: &quot;^7.2&quot;,
        &quot;laravel/breeze&quot;: &quot;^1.20&quot;,
        &quot;laravel/framework&quot;: &quot;^10.8&quot;,
        &quot;laravel/sanctum&quot;: &quot;^3.2&quot;,
        &quot;laravel/tinker&quot;: &quot;^2.8&quot;,
        &quot;livewire/livewire&quot;: &quot;^2.12&quot;,
        &quot;simplesoftwareio/simple-qrcode&quot;: &quot;^4.2&quot;
    },
    &quot;require-dev&quot;: {
        &quot;fakerphp/faker&quot;: &quot;^1.9.1&quot;,
        &quot;laravel/pint&quot;: &quot;^1.0&quot;,
        &quot;laravel/sail&quot;: &quot;^1.18&quot;,
        &quot;mockery/mockery&quot;: &quot;^1.4.4&quot;,
        &quot;nunomaduro/collision&quot;: &quot;^7.0&quot;,
        &quot;phpunit/phpunit&quot;: &quot;^10.1&quot;,
        &quot;spatie/laravel-ignition&quot;: &quot;^2.0&quot;
    },
    &quot;autoload&quot;: {
        &quot;psr-4&quot;: {
            &quot;App\\&quot;: &quot;app/&quot;,
            &quot;Database\\Factories\\&quot;: &quot;database/factories/&quot;,
            &quot;Database\\Seeders\\&quot;: &quot;database/seeders/&quot;
        }
    },
    &quot;autoload-dev&quot;: {
        &quot;psr-4&quot;: {
            &quot;Tests\\&quot;: &quot;tests/&quot;
        }
    },
    &quot;scripts&quot;: {
        &quot;post-autoload-dump&quot;: [
            &quot;Illuminate\\Foundation\\ComposerScripts::postAutoloadDump&quot;,
            &quot;@php artisan package:discover --ansi&quot;
        ],
        &quot;post-update-cmd&quot;: [
            &quot;@php artisan vendor:publish --tag=laravel-assets --ansi --force&quot;
        ],
        &quot;post-root-package-install&quot;: [
            &quot;@php -r \&quot;file_exists(&#39;.env&#39;) || copy(&#39;.env.example&#39;, &#39;.env&#39;);\&quot;&quot;
        ],
        &quot;post-create-project-cmd&quot;: [
            &quot;@php artisan key:generate --ansi&quot;
        ]
    },
    &quot;extra&quot;: {
        &quot;laravel&quot;: {
            &quot;dont-discover&quot;: []
        }
    },
    &quot;config&quot;: {
         &quot;platform&quot;: {
            &quot;php&quot;: &quot;8.1&quot;
         },
        &quot;platform-check&quot;: false,
        &quot;optimize-autoloader&quot;: true,
        &quot;preferred-install&quot;: &quot;dist&quot;,
        &quot;sort-packages&quot;: true,
        &quot;allow-plugins&quot;: {
            &quot;pestphp/pest-plugin&quot;: true,
            &quot;php-http/discovery&quot;: true
        }
    },
    &quot;minimum-stability&quot;: &quot;stable&quot;,
    &quot;prefer-stable&quot;: true
}

The error file Functions.php

&lt;?php

declare(strict_types=1);

namespace Termwind;

use Closure;
use Symfony\Component\Console\Output\OutputInterface;
use Termwind\Repositories\Styles as StyleRepository;
use Termwind\ValueObjects\Style;
use Termwind\ValueObjects\Styles;

if (! function_exists(&#39;Termwind\renderUsing&#39;)) {
    /**
     * Sets the renderer implementation.
     */
    function renderUsing(OutputInterface|null $renderer): void
    {
        Termwind::renderUsing($renderer);
    }
}

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /home/vol18_2/epizy.com/epiz_34191254/htdocs/BCM_Bank/vendor/nunomaduro/termwind/src/Functions.php on line 17

答案1

得分: 1

The declaration of your renderUsing() function includes a union type declaration OutputInterface|null but that syntax is not supported until PHP 8.0. Upgrade your PHP installation.

英文:

The declaration of your renderUsing() function includes a union type declaration OutputInterface|null but that syntax is not supported until PHP 8.0. Upgrade your PHP installation.

function renderUsing(OutputInterface|null $renderer): void
{
    Termwind::renderUsing($renderer);
}

huangapple
  • 本文由 发表于 2023年5月13日 13:32:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76241227.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定