企业架构师逆向工程:PHP"意外的符号:["

时间:2017-06-14 09:43:45

标签: php laravel enterprise-architect component-diagram

我尝试使用Enterprise Architect工具通过逆向工程在PHP中创建组件图。但是当我尝试执行它时会出现错误。这些是错误日志:

There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 9.  Unexpected symbol: [ 
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 17.  Unexpected symbol: [    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 9.  Unexpected symbol: [ 
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 17.  Unexpected symbol: [    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 10.  Unexpected symbol: ,  
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 10.  Unexpected symbol: ,  
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 10.  Unexpected symbol: ,    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 18.  Unexpected symbol: ,    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 9.  Unexpected symbol: [ 
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 17.  Unexpected symbol: [    

例如,以下是 Client.php

的代码
<?php

    namespace App;

    use Illuminate\Database\Eloquent\Model;

    class Client extends Model
    {
        protected $fillable = [
            'PI', 'BusinessName'
        ];

        public function address()
        {
            return $this->belongsTo(Address::class);
        }

        public function users()
        {
            return $this->hasMany(User::class);
        }

错误解析在 protected $ fillable = [             &#39; PI&#39;,&#39; BusinessName&#39;         ]; 我不知道这是否可以帮助你,但我使用的是Laravel框架。 有人可以帮帮我吗?

2 个答案:

答案 0 :(得分:3)

正如其他人所指出的,$array = [ 'key' => 'value' ];语法是在php 5.4中引入的 默认情况下,ea,php生成使用版本5.3,但您可以将其更改为5.6。 请按照以下屏幕截图: Click the Configure ribbon then the Options Menu Once in the Manage project Options dialog, you can change the default version for PHP

答案 1 :(得分:2)

检查你的PHP版本,数组语法$array = [ 'key' => 'value' ];仅在PHP 5.5中引入(我相信)所以更少的东西会导致语法错误。