英文:
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 '|', 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
答案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);
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论