Skip to content

Exception thrown #12

@khalidchawtany

Description

@khalidchawtany

Sometimes I get this error when working in a php file and it prevents you from working. This never happened before. I saw this for the first time today after I did :call dein#update()

[ncm2_phpactor@yarp] error caught in notification handler 'on_complete [{'filepath': '/Users/juju/Projects/PHP/knights/app/Http/Controllers/BalanceController.php', 'typed': '        dd($', 'scope_match': 'php', 'startccol': 12, 'scope_level': 1, 'word_pattern': '[\\$\\w][\\w]*', 'time': 1544893109.6483479, 'lnum': 71, 'bufnr': 14, 'changedtick': 148, 'manual': 0, 'base': '$', 'ccol': 13, 'filetype': 'php', 'curpos': [0, 71, 13, 0, 13], 'tick': [[0, 71, 13], 14], 'early_cache': False, 'context_id': 1298, 'scope': 'php', 'matcher': {'name': 'abbrfuzzy'}, 'source': {'on_complete': 'ncm2_phpactor#on_complete', 'subscope_enable': 1, 'early_cache': 0, 'name': 'phpactor', 'scope': ['php'], 'mark': 'b', 'on_warmup': 'ncm2_phpactor#on_warmup', 'ready': 1, 'enable': 1, 'auto_popup': 1, 'priority': 9, 'complete_pattern': ['\\$', '-\\>', '::'], 'word_pattern': '[\\$\\w][\\w]*'}, 'bcol': 13, 'match_end': 12}, ['<?php', '', 'namespace App\\Http\\Controllers;', '', 'use App\\Http\\Controllers\\Controller;', 'use Illuminate\\Http\\Request;', 'use Spatie\\QueryBuilder\\QueryBuilder;', '', 'use App\\Balance;', 'use App\\Office;', 'use App\\Merchant;', 'use App\\Product;', '', 'use App\\Http\\Requests\\Balances\\StoreBalance;', 'use App\\Http\\Requests\\Balances\\UpdateBalance;', 'use App\\Http\\Requests\\Balances\\RemoveBalance;', '', 'class BalanceController extends Controller', '{', '    /**', '     * Create a new controller instance.', '     *', '     * @return void', '     */', '    public function __construct()', '    {', "        $this->middleware(['auth', 'user.id']);", "        $this->middleware('permission:view_balance', ['only' => ['index', 'list']]);", "        $this->middleware('permission:create_balance|create_transaction', ['only' => ['create']]);", "        $this->middleware('permission:update_balance', ['only' => ['update']]);", "        $this->middleware('permission:destroy_balance', ['only' => ['destroy']]);", '    }', '', '    public function index()', '    {', "        return view('balances.index');", '    }', '', '    public function list(Request $request)', '    {', '        return QueryBuilder::for(Balance::class)', "            ->LeftJoin('products', 'balances.product_id', 'products.id')", "            ->LeftJoin('merchants', 'balances.merchant_id', 'merchants.id')", "            ->LeftJoin('offices', 'balances.office_id', 'offices.id')", "            ->selectRaw('balances.*, merchants.name as merchant_name, offices.name as office_name, offices.phone as office_phone, merchants.phone as merchant_phone, products.name as product_name, products.amount_limit as amount_limit')", '            ->allowedFilters(', "                'balance',", "                'balances.id',", "                'expiry_date',", "                'products.amount_limit',", "                'balances.car_limit',", "                'products.name',", "                'balances.note',", "                'products.name',", "                'merchants.name',", "                'offices.name'", '            )', "            ->orderBy('id', 'desc')", '            ->jsonPaginate();', '    }', '', '', '    /**', '     * Create a new _balance instance after a valid registration.', '     *', '     * @param  array  $data', '     * @return \\App\\Balance', '     */', '    protected function create(StoreBalance $request)', '    {', '        dd($)', "        $product = Product::where(['name' =>$request->product_name])->firstOrFail();", '', "        $merchant_id = merchant::where(['name' =>$request->merchant_name])->firstOrFail()->id;", '', "        $office_id = office::where(['name' =>$request->office_name])->firstOrFail()->id;", '', "        if($product->requiresCarBalance() && !$request->filled('car_limit'))", "            return ezReturnErrorMessage('Number of cars is required!');", '', '        $balance = Balance::create(array_merge($request->input(), [', "            'product_id' => $product->id,", "            'office_id' => $office_id,", "            'merchant_id' => $merchant_id", '        ]));', '', "        return ezReturnSuccessMessage('Balance created successfully!', $balance);", '    }', '', '    public function update(UpdateBalance $request)', '    {', '        $Balance = Balance::findOrFail($request->id);', '', '        $Balance->update($request->input());', '', "        return ezReturnSuccessMessage('Balance updated successfully!');", '    }', '', '    public function destroy(Request $request)', '    {', '', '        $Balance = Balance::findOrFail($request->id);', '', '        $Balance->delete();', '', "        return ezReturnSuccessMessage('Balance removed successfully!');", '', '    }', '', '    public function productBalance(Request $request){', '', "        if(!$request->filled('product_name'))", '            return;', '', '        $balanceInfo = [', "            'product_requires_balance' =>null,", "            'rows' => []", '        ];', '', '        //Data template', "        //[{name:'n11',value:'v12',editor:'text',group:'Product Information'}]", '', "        $product = Product::where(['name' =>$request->product_name])->first();", '', '        if($product == null)', '            return $balanceInfo;', '', "        $balanceInfo['product_requires_balance'] = $product->requiresBalance();", '', '        $this->setProductInformation($product, $balanceInfo);', '        $this->setCheckTypeInformation($product, $balanceInfo);', '        return $balanceInfo;', '', '    }', '', '    function setProductInformation($product, &$balanceInfo)', '    {', '        if($product->requiresBalance())', '        {', "            $balanceInfo['product'] = $product;", "            $balanceInfo['merchant'] = $product->requiresBalance();", "            array_push($balanceInfo['rows'], ['name'=>'Name','value'=>$product->name,'group'=>'Product Information']);", '            array_push($balanceInfo[\'rows\'], [\'name\'=>\'Requires Balance\',\'value\'=>\'<span style="color:red; font-weight:bold;">Yes</span>\',\'group\'=>\'Product Information\']);', '', "            array_push($balanceInfo['rows'],", '                [', "                    'name'=>'Has Amount Limit',", "                    'value'=> $product->requiresAmountBalance() ? 'Yes' : 'No',", "                    'group'=>'Product Information'", '                ]);', '', "            array_push($balanceInfo['rows'],", '                [', "                    'name'=>'Has Car Limit',", "                    'value'=> $product->requiresCarBalance() ? 'Yes' : 'No',", "                    'group'=>'Product Information'", '                ]);', '', '            if($product->amount_limit != null){', "                array_push($balanceInfo['rows'],", '                    [', "                        'name'=>'Amount Limit',", "                        'value'=>$product->amount_limit . ' ' . $product->amount_limit_unit . '(s)',", "                        'group'=>'Product Information'", '                    ]);', '            }', '', '            if($product->date_limit != null){', "                array_push($balanceInfo['rows'],", '                    [', "                        'name'=>'Day Limit',", "                        'value'=>'Expires in '.$product->date_limit. ' days',", "                        'group'=>'Product Information'", '                    ]);', '            }', '        }', '        else {', "            array_push($balanceInfo['rows'],", '                [', "                    'name'=>'Requires Balance',", "                    'value'=>'No',", "                    'group'=>'Product Information'", '                ]);', '            return $balanceInfo;', '        }', '    }', '', '    function setCheckTypeInformation($product, &$balanceInfo)', '    {', "        $checkTypes = \\App\\CheckType:: LeftJoin('product_check_type', 'product_check_type.check_type_id', 'check_types.id')", "            ->selectRaw('id,category,subcategory,price')", "            ->where('product_id', $product->id)->get();", '', '        foreach($checkTypes as $checkType)', '        {', "            array_push($balanceInfo['rows'],", '                [', "                    'name'=>$checkType->category,", "                    'value'=>$checkType->price
[ncm2_phpactor@yarp] ,", "                    'group'=>'Test Information'", '                ]);', '        }', '', '    }', '', '', '}'], '/Users/juju/Projects/PHP/knights', ['php', '/Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/plugin/../bin/phpactor', 'complete', '-d', '/Users/juju/Development/Applications/neovim-qt/neovim-qt/build/bin', '--format=json', '--', 'stdin', '2221']]'
[ncm2_phpactor@yarp] Traceback (most recent call last):
[ncm2_phpactor@yarp]   File "/Users/juju/.config/nvim/dein/.cache/init.vim/.dein/pythonx/yarp.py", line 30, in on_notification
[ncm2_phpactor@yarp]     getattr(module_obj, method)(*args)
[ncm2_phpactor@yarp]   File "/Users/juju/.config/nvim/dein/.cache/init.vim/.dein/pythonx/ncm2.py", line 206, in on_complete
[ncm2_phpactor@yarp]     on_complete_impl(context, *args)
[ncm2_phpactor@yarp]   File "/Users/juju/.config/nvim/dein/.cache/init.vim/.dein/pythonx/ncm2_phpactor.py", line 55, in on_complete
[ncm2_phpactor@yarp]     for e in result['suggestions']:
[ncm2_phpactor@yarp] KeyError: 'suggestions'
[php]  syntax error, unexpected ')', expecting variable (T_VARIABLE) or '{' or '$'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions