Alias
Alias

Reputation: 721

Symfony error in Dynamic Form yii2

I did a composer update in my yii2 project and after that I'm getting syntax error, unexpected '?' in /vendor/symfony folder in several places dom-crawler etc. in yii2.

I'm only getting error while I'm opening form with yii2 dynamic form. The other view files are working fine.

composer.json file - 
{
    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Project Template",
    "keywords": ["yii2", "framework", "advanced", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": ">=2.0.6",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "kartik-v/yii2-widget-sidenav": "*",
        "kartik-v/yii2-grid": "*",
        "2amigos/yii2-date-picker-widget": "~1.0",
        "kartik-v/yii2-widget-select2": "@dev",
        "reportico/yii2-reportico": "dev-master",
        "miloschuman/yii2-highcharts-widget": "*",
        "kartik-v/dependent-dropdown": "dev-master",
        "kartik-v/yii2-widget-depdrop": "@dev",
        "kartik-v/yii2-date-range": "*",
        "kartik-v/yii2-widget-activeform": "@dev",
        "yiisoft/yii2-jui": "^2.0",
        "kartik-v/yii2-widget-datetimepicker": "*",
        "kartik-v/yii2-widget-datepicker": "@dev",
        "kartik-v/yii2-field-range": "*",
        "wbraganca/yii2-dynamicform": "*",
        "yiisoft/yii2-debug": "^2.0",
        "mpdf/mpdf": "^6.1",
        "kartik-v/yii2-mpdf": "*",
        "beaten-sect0r/yii2-db-manager": "*",
        "spanjeta/yii2-backup": "*",
        "warrence/yii2-kartikgii": "dev-master",
        "kartik-v/yii2-export": "*"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

php version - 7.0.2

I tried to remove vendor directory, clear cache and composer install again with same result.

Upvotes: 0

Views: 857

Answers (2)

BINAY THAPA MAGAR
BINAY THAPA MAGAR

Reputation: 4371

Try upgrading your php version. It worked with me.

Upvotes: 0

rob006
rob006

Reputation: 22174

First, you should lock your PHP version in composer.json config:

"config": {
    "platform": {
        "php": "7.0"
    }
}, 

It looks like you're using different PHP version for installing packages, so Composer is installing packages that require PHP 7.1. Adding this will force Composer to install versions for PHP 7.0.

Second, you should really avoid constraints like >=2.0.6, @dev or *. This will allow Composer to upgrade packages to new major version which may (and probably will) introduce backward compatibility break. So even if package will work on PHP 7.0, it may break your app.

Upvotes: 2

Related Questions