FatalErrorException on line 265 Inflector.php: syntax error, unexpected ':', expecting ';' or '{'

I went to update the composer using

composer update

after updating having the following error:

FatalErrorException on line 265 Inflector.php: syntax error, unexpected ':', pending ';' or '{'

Please, help

Thanks in advance

Using Laravel Framework version 5.2.45

here is the composer code

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "laravelcollective/html": "*.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/Libraries/Functions.php"
        ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

Please see the inflector.php function for an error.

public static function tableize(string $word) : string
    {
        return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
    }
+4
source share
3 answers

This is a problem with the PHP version, upgrading to PHP 7.0 and doctrine / inflector will work properly, because doctrine / inflector 1.20 and higher require PHP 7.

PHP, doctrine/inflector, :

  • composer.lock

    rm -f Composer.lock

  • rm -R -f vendor

  • composer install

  • / php

    composer require doctrine/inflector:1.1.0

doctrine/inflector: 1.1.0 PHP 5.6 . php,

+6

, , .

laravelcollective/html , 5.5.x. , , "doctrine/inflector": "~1.1",, 2.0, 1.3.0 , PHP 7.0 .

inflector.php, , 265, PHP 7.0 .

PHP 5.6.24, .

laravelcollective/html, Laravel. , 5.2.*.

+3

, . . / php >= 7 - ( , .json /). , laravel 5.4.

I ran rm -f Composer.lockand rm -R -f vendorthen executed composer installafter vagrant sshin the guest VM that used php 5.6.8 (I originally worked with the composer from my MacBook terminal that used php 7)

This resolved the issues.

+1
source

Source: https://habr.com/ru/post/1692526/


All Articles