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

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

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

  1. 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

  1. {
  2. "name": "laravel/laravel",
  3. "type": "project",
  4. "description": "The Laravel Framework.",
  5. "keywords": ["framework", "laravel"],
  6. "license": "MIT",
  7. "require": {
  8. "php": "^8.1",
  9. "carbondate/carbon": "*",
  10. "guzzlehttp/guzzle": "^7.2",
  11. "laravel/breeze": "^1.20",
  12. "laravel/framework": "^10.8",
  13. "laravel/sanctum": "^3.2",
  14. "laravel/tinker": "^2.8",
  15. "livewire/livewire": "^2.12",
  16. "simplesoftwareio/simple-qrcode": "^4.2"
  17. },
  18. "require-dev": {
  19. "fakerphp/faker": "^1.9.1",
  20. "laravel/pint": "^1.0",
  21. "laravel/sail": "^1.18",
  22. "mockery/mockery": "^1.4.4",
  23. "nunomaduro/collision": "^7.0",
  24. "phpunit/phpunit": "^10.1",
  25. "spatie/laravel-ignition": "^2.0"
  26. },
  27. "autoload": {
  28. "psr-4": {
  29. "App\\": "app/",
  30. "Database\\Factories\\": "database/factories/",
  31. "Database\\Seeders\\": "database/seeders/"
  32. }
  33. },
  34. "autoload-dev": {
  35. "psr-4": {
  36. "Tests\\": "tests/"
  37. }
  38. },
  39. "scripts": {
  40. "post-autoload-dump": [
  41. "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
  42. "@php artisan package:discover --ansi"
  43. ],
  44. "post-update-cmd": [
  45. "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
  46. ],
  47. "post-root-package-install": [
  48. "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
  49. ],
  50. "post-create-project-cmd": [
  51. "@php artisan key:generate --ansi"
  52. ]
  53. },
  54. "extra": {
  55. "laravel": {
  56. "dont-discover": []
  57. }
  58. },
  59. "config": {
  60. "platform": {
  61. "php": "8.1"
  62. },
  63. "platform-check": false,
  64. "optimize-autoloader": true,
  65. "preferred-install": "dist",
  66. "sort-packages": true,
  67. "allow-plugins": {
  68. "pestphp/pest-plugin": true,
  69. "php-http/discovery": true
  70. }
  71. },
  72. "minimum-stability": "stable",
  73. "prefer-stable": true
  74. }

The error file Functions.php

  1. <?php
  2. declare(strict_types=1);
  3. namespace Termwind;
  4. use Closure;
  5. use Symfony\Component\Console\Output\OutputInterface;
  6. use Termwind\Repositories\Styles as StyleRepository;
  7. use Termwind\ValueObjects\Style;
  8. use Termwind\ValueObjects\Styles;
  9. if (! function_exists('Termwind\renderUsing')) {
  10. /**
  11. * Sets the renderer implementation.
  12. */
  13. function renderUsing(OutputInterface|null $renderer): void
  14. {
  15. Termwind::renderUsing($renderer);
  16. }
  17. }

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

  1. 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

  1. {
  2. &quot;name&quot;: &quot;laravel/laravel&quot;,
  3. &quot;type&quot;: &quot;project&quot;,
  4. &quot;description&quot;: &quot;The Laravel Framework.&quot;,
  5. &quot;keywords&quot;: [&quot;framework&quot;, &quot;laravel&quot;],
  6. &quot;license&quot;: &quot;MIT&quot;,
  7. &quot;require&quot;: {
  8. &quot;php&quot;: &quot;^8.1&quot;,
  9. &quot;carbondate/carbon&quot;: &quot;*&quot;,
  10. &quot;guzzlehttp/guzzle&quot;: &quot;^7.2&quot;,
  11. &quot;laravel/breeze&quot;: &quot;^1.20&quot;,
  12. &quot;laravel/framework&quot;: &quot;^10.8&quot;,
  13. &quot;laravel/sanctum&quot;: &quot;^3.2&quot;,
  14. &quot;laravel/tinker&quot;: &quot;^2.8&quot;,
  15. &quot;livewire/livewire&quot;: &quot;^2.12&quot;,
  16. &quot;simplesoftwareio/simple-qrcode&quot;: &quot;^4.2&quot;
  17. },
  18. &quot;require-dev&quot;: {
  19. &quot;fakerphp/faker&quot;: &quot;^1.9.1&quot;,
  20. &quot;laravel/pint&quot;: &quot;^1.0&quot;,
  21. &quot;laravel/sail&quot;: &quot;^1.18&quot;,
  22. &quot;mockery/mockery&quot;: &quot;^1.4.4&quot;,
  23. &quot;nunomaduro/collision&quot;: &quot;^7.0&quot;,
  24. &quot;phpunit/phpunit&quot;: &quot;^10.1&quot;,
  25. &quot;spatie/laravel-ignition&quot;: &quot;^2.0&quot;
  26. },
  27. &quot;autoload&quot;: {
  28. &quot;psr-4&quot;: {
  29. &quot;App\\&quot;: &quot;app/&quot;,
  30. &quot;Database\\Factories\\&quot;: &quot;database/factories/&quot;,
  31. &quot;Database\\Seeders\\&quot;: &quot;database/seeders/&quot;
  32. }
  33. },
  34. &quot;autoload-dev&quot;: {
  35. &quot;psr-4&quot;: {
  36. &quot;Tests\\&quot;: &quot;tests/&quot;
  37. }
  38. },
  39. &quot;scripts&quot;: {
  40. &quot;post-autoload-dump&quot;: [
  41. &quot;Illuminate\\Foundation\\ComposerScripts::postAutoloadDump&quot;,
  42. &quot;@php artisan package:discover --ansi&quot;
  43. ],
  44. &quot;post-update-cmd&quot;: [
  45. &quot;@php artisan vendor:publish --tag=laravel-assets --ansi --force&quot;
  46. ],
  47. &quot;post-root-package-install&quot;: [
  48. &quot;@php -r \&quot;file_exists(&#39;.env&#39;) || copy(&#39;.env.example&#39;, &#39;.env&#39;);\&quot;&quot;
  49. ],
  50. &quot;post-create-project-cmd&quot;: [
  51. &quot;@php artisan key:generate --ansi&quot;
  52. ]
  53. },
  54. &quot;extra&quot;: {
  55. &quot;laravel&quot;: {
  56. &quot;dont-discover&quot;: []
  57. }
  58. },
  59. &quot;config&quot;: {
  60. &quot;platform&quot;: {
  61. &quot;php&quot;: &quot;8.1&quot;
  62. },
  63. &quot;platform-check&quot;: false,
  64. &quot;optimize-autoloader&quot;: true,
  65. &quot;preferred-install&quot;: &quot;dist&quot;,
  66. &quot;sort-packages&quot;: true,
  67. &quot;allow-plugins&quot;: {
  68. &quot;pestphp/pest-plugin&quot;: true,
  69. &quot;php-http/discovery&quot;: true
  70. }
  71. },
  72. &quot;minimum-stability&quot;: &quot;stable&quot;,
  73. &quot;prefer-stable&quot;: true
  74. }

The error file Functions.php

  1. &lt;?php
  2. declare(strict_types=1);
  3. namespace Termwind;
  4. use Closure;
  5. use Symfony\Component\Console\Output\OutputInterface;
  6. use Termwind\Repositories\Styles as StyleRepository;
  7. use Termwind\ValueObjects\Style;
  8. use Termwind\ValueObjects\Styles;
  9. if (! function_exists(&#39;Termwind\renderUsing&#39;)) {
  10. /**
  11. * Sets the renderer implementation.
  12. */
  13. function renderUsing(OutputInterface|null $renderer): void
  14. {
  15. Termwind::renderUsing($renderer);
  16. }
  17. }

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.

  1. function renderUsing(OutputInterface|null $renderer): void
  2. {
  3. Termwind::renderUsing($renderer);
  4. }

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:

确定