ncm2-phpactor
ncm2-phpactor copied to clipboard
Exception thrown
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 '$'
Just a guess, but which version of PHP are yih using? 7.0 is no longer supported.
>> php --version
PHP 7.3.0 (cli) (built: Dec 7 2018 11:00:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.0, Copyright (c) 1999-2018, by Zend Technologies
I tries restarting neovim and opened the same file and went to insert mode in the same place and the error was thrown
"~/Projects/PHP/knights/app/Http/Controllers/BalanceController.php" 207L, 6770C
[LC] Project root: /Users/juju/Projects/PHP/knights
[ncm2_phpactor@yarp] error caught in notification handler 'on_complete [{'filepath': '/Users/juju/Projects/PHP/knights/app/Http/Controllers/BalanceController.php', 'typed': ' dd($request->input', 'scope_match': 'php', 'startccol': 22, 'scope_level': 1, 'word_pattern': '[\\$\\w][\\w]*', 'time': 1544894434.405078, 'lnum': 71, 'bufnr': 3, 'changedtick': 2, 'manual': 0, 'base': 'input', 'ccol': 27, 'filetype': 'php', 'curpos': [0, 71, 27, 0, 27], 'tick': [[0, 71, 27], 0], 'early_cache': False, 'context_id': 29, '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': 27, 'match_end': 21}, ['<?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($request->input);', " $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,", "
[ncm2_phpactor@yarp] 'value'=>$checkType->price,", " 'group'=>'Test Information'", ' ]);', ' }', '', ' }', '', '', '}'], '/Users/juju/Projects/PHP/knights/app/Http/Controllers', ['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', '2235']]'
[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'
The only match
The only match
[LC] [Warning] Could not compute cache key for barryvdh/laravel-ide-helper
[LC] [Warning] Could not compute cache key for spatie/laravel-json-api-paginate
strange, the next thing would be to invoke Phpactor directly and get a stack trace and identify the issue:
echo '<?php array_key_exists' | ~/.vim/<plugged>/phpactor/bin/phpactor complete stdin 17 --format=json
(where <plugged> is the plugin directory used by your plugin manager).
It could be related to this issue
this is what I get:
echo '<?php array_key_exists' | ./phpactor complete stdin 17 --format=json
{"suggestions":[{"type":"function","name":"array_key_exists","label":"array_key_exists","short_description":"array_key_exists($key, array|ArrayObject $search): bool","class_import":null,"info":"array_key_exists($key, array|ArrayObject $search): bool"}],"issues":[]}
@dantleech Is there any way to manually tell it to show completion for a cursor location in a file?
sure, just phpactor complete src/Path/To/File.php 1234 (where 1234 is the offset).
you may also be able to reproduce the error with omni complete. As this uses RPC for completion, you can enable rpc.store_replay and playback the problematic RPC call.
When I try to launch it from command line I get the following list Exception
Update: moved exception detail to a gist
Can you try omni complete as indicated above? If you can reproduce the issue there that would be great.
This is what I get if I set the omnifun
Error detected while processing function phpactor#Complete:
line 36:
E714: List required
I changed the phpactor.vim Completefunction as follows:
let result = phpactor#rpc("complete", { "offset": offset, "source": source, "type": &ft})
echomsg 'result:' result
let suggestions = result['suggestions']
let issues = result['issues']
The content of the result variable is 0
Manually running phpactor returns the following:
>> /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/bin/phpactor complete ~/Projects/PHP/knights/app/Http/Controllers/BalanceController.php 2010
suggestions:
issues:
Yep, this would indicate an error. Now you can enable the rpc.store_replay option as per debugging and use the command line phpactor rpc --replay -v command to reply the command and get a precise error.
This is what I get using <c-x><c-o>:
/Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/bin/phpactor rpc --replay --pretty -v
[2018-12-16 10:07:27] phpactor.DEBUG: REQUEST {"action":"complete","parameters":{"source":"<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse Spatie\\QueryBuilder\\QueryBuilder;\n\nuse App\\Balance;\nuse App\\Office;\nuse App\\Merchant;\nuse App\\Product;\n\nuse App\\Http\\Requests\\Balances\\StoreBalance;\nuse App\\Http\\Requests\\Balances\\UpdateBalance;\nuse App\\Http\\Requests\\Balances\\RemoveBalance;\n\nclass BalanceController extends Controller\n{\n /**\n * Create a new controller instance.\n *\n * @return void\n */\n public function __construct()\n {\n $this->middleware(['auth', 'user.id']);\n $this->middleware('permission:view_balance', ['only' => ['index', 'list']]);\n $this->middleware('permission:create_balance|create_transaction', ['only' => ['create']]);\n $this->middleware('permission:update_balance', ['only' => ['update']]);\n $this->middleware('permission:destroy_balance', ['only' => ['destroy']]);\n }\n\n public function index()\n {\n return view('balances.index');\n }\n\n public function list(Request $request)\n {\n return QueryBuilder::for(Balance::class)\n ->LeftJoin('products', 'balances.product_id', 'products.id')\n ->LeftJoin('merchants', 'balances.merchant_id', 'merchants.id')\n ->LeftJoin('offices', 'balances.office_id', 'offices.id')\n ->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')\n ->allowedFilters(\n 'balance',\n 'balances.id',\n 'expiry_date',\n 'products.amount_limit',\n 'balances.car_limit',\n 'products.name',\n 'balances.note',\n 'products.name',\n 'merchants.name',\n 'offices.name'\n )\n ->orderBy('id', 'desc')\n ->jsonPaginate();\n }\n\n\n /**\n * Create a new _balance instance after a valid registration.\n *\n * @param array $data\n * @return \\App\\Balance\n */\n protected function create(StoreBalance $request)\n {\n dd($request->input\n $product = Product::findOrFail($request->product_id);\n if($product->requiresCarBalance() && !$request->filled('car_limit'))\n return ezReturnErrorMessage('Car Limit is required!');\n\n $balance = Balance::create($request->input());\n\n return ezReturnSuccessMessage('Balance created successfully!', $balance);\n }\n\n public function update(UpdateBalance $request)\n {\n $Balance = Balance::findOrFail($request->id);\n\n $Balance->update($request->input());\n\n return ezReturnSuccessMessage('Balance updated successfully!');\n }\n\n public function destroy(Request $request)\n {\n\n $Balance = Balance::findOrFail($request->id);\n\n $Balance->delete();\n\n return ezReturnSuccessMessage('Balance removed successfully!');\n\n }\n\n public function productBalance(Request $request){\n\n if(!$request->filled('product_name'))\n return;\n\n $balanceInfo = [\n 'product_requires_balance' =>null,\n 'rows' => []\n ];\n\n //Data template\n //[{name:'n11',value:'v12',editor:'text',group:'Product Information'}]\n\n $product = Product::where(['name' =>$request->product_name])->first();\n\n if($product == null)\n return $balanceInfo;\n\n $balanceInfo['product_requires_balance'] = $product->requiresBalance();\n\n $this->setProductInformation($product, $balanceInfo);\n $this->setCheckTypeInformation($product, $balanceInfo);\n return $balanceInfo;\n\n }\n\n function setProductInformation($product, &$balanceInfo)\n {\n if($product->requiresBalance())\n {\n $balanceInfo['product'] = $product;\n $balanceInfo['merchant'] = $product->requiresBalance();\n array_push($balanceInfo['rows'], ['name'=>'Name','value'=>$product->name,'group'=>'Product Information']);\n array_push($balanceInfo['rows'], ['name'=>'Requires Balance','value'=>'<span style=\"color:red; font-weight:bold;\">Yes</span>','group'=>'Product Information']);\n\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Has Amount Limit',\n 'value'=> $product->requiresAmountBalance() ? 'Yes' : 'No',\n 'group'=>'Product Information'\n ]);\n\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Has Car Limit',\n 'value'=> $product->requiresCarBalance() ? 'Yes' : 'No',\n 'group'=>'Product Information'\n ]);\n\n if($product->amount_limit != null){\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Amount Limit',\n 'value'=>$product->amount_limit . ' ' . $product->amount_limit_unit . '(s)',\n 'group'=>'Product Information'\n ]);\n }\n\n if($product->date_limit != null){\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Day Limit',\n 'value'=>'Expires in '.$product->date_limit. ' days',\n 'group'=>'Product Information'\n ]);\n }\n }\n else {\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Requires Balance',\n 'value'=>'No',\n 'group'=>'Product Information'\n ]);\n return $balanceInfo;\n }\n }\n\n function setCheckTypeInformation($product, &$balanceInfo)\n {\n $checkTypes = \\App\\CheckType:: LeftJoin('product_check_type', 'product_check_type.check_type_id', 'check_types.id')\n ->selectRaw('id,category,subcategory,price')\n ->where('product_id', $product->id)->get();\n\n foreach($checkTypes as $checkType)\n {\n array_push($balanceInfo['rows'],\n [\n 'name'=>$checkType->category,\n 'value'=>$checkType->price,\n 'group'=>'Test Information'\n ]);\n }\n\n }\n\n\n}","offset":2235,"type":"php"}} []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Statement\ClassDeclaration [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Parameter [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\Variable [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\StringLiteral [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\StringLiteral [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\StringLiteral [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\StringLiteral [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ArrayCreationExpression [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\StringLiteral [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\StringLiteral [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\ReservedWord [] []
[2018-12-16 10:07:28] phpactor.DEBUG: RESPONSE {"action":"return","parameters":{"value":{"suggestions":[{"type":"method","name":"input","label":"input","short_description":"pub input(string|null $key = NULL, string|array|null $default = NULL): string|array|null","class_import":null,"info":"pub input(string|null $key = NULL, string|array|null $default = NULL): string|array|null"}],"issues":[]}}} []
{
"version": "1.0.0",
"action": "return",
"parameters": {
"value": {
"suggestions": [
{
"type": "method",
"name": "input",
"label": "input",
"short_description": "pub input(string|null $key = NULL, string|array|null $default = NULL): string|array|null",
"class_import": null,
"info": "pub input(string|null $key = NULL, string|array|null $default = NULL): string|array|null"
}
],
"issues": []
}
}
}%
Although I still get the error in vim
Error detected while processing function phpactor#Complete:
line 36:
E714: List required
Running from terminal I get:
/Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/bin/phpactor complete ~/Projects/PHP/knights/app/Http/Controllers/BalanceController.php 2235
suggestions:
0:
type:variable
name:$request
label:$request
short_description:StoreBalance => param #1 $var
class_import:
info:StoreBalance => param #1 $var
1:
type:variable
name:$this
label:$this
short_description:BalanceController => param #1 $var
class_import:
info:BalanceController => param #1 $var
issues:
hm, wondering how this related to the original error: [php] syntax error, unexpected ')', expecting variable (T_VARIABLE) or '{' or '$'
does downgrading Phpactor help? (just git checkout f.e. 0.10.0)
I just got this exception after downgrading to 0.10.0:
/Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/bin/phpactor rpc --replay --pretty -v
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "ConfigLoader" from namespace "Phpactor\Config".
Did you forget a "use" statement for e.g. "Phpactor\ConfigLoader\Core\ConfigLoader" or "Phpactor\Config\ConfigLoader"? in /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Phpactor.php:41
Stack trace:
#0 /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Application.php(106): Phpactor\Phpactor::boot(Object(Symfony\Component\Console\Input\ArgvInput), '/Users/juju/.co...')
#1 /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Application.php(37): Phpactor\Application->initialize(Object(Symfony\Component\Console\Input\ArgvInput))
#2 /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/vendor/symfony/console/Application.php(145): Phpactor\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Users/juju/.config/nvim/dein/repos/github.co in /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Phpactor.php on line 41
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "ConfigLoader" from namespace "Phpactor\Config".
Did you forget a "use" statement for e.g. "Phpactor\ConfigLoader\Core\ConfigLoader" or "Phpactor\Config\ConfigLoader"? in /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Phpactor.php:41
Stack trace:
#0 /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Application.php(106): Phpactor\Phpactor::boot(Object(Symfony\Component\Console\Input\ArgvInput), '/Users/juju/.co...')
#1 /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Application.php(37): Phpactor\Application->initialize(Object(Symfony\Component\Console\Input\ArgvInput))
#2 /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/vendor/symfony/console/Application.php(145): Phpactor\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Users/juju/.config/nvim/dein/repos/github.co in /Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/lib/Phpactor.php on line 41
Forgot to run composer install after checking out :)
after composer install I get :
/Users/juju/.config/nvim/dein/repos/github.com/phpactor/phpactor/bin/phpactor rpc --replay --pretty -v
[2018-12-16 10:38:34] phpactor.DEBUG: REQUEST {"action":"complete","parameters":{"source":"<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse Spatie\\QueryBuilder\\QueryBuilder;\n\nuse App\\Balance;\nuse App\\Office;\nuse App\\Merchant;\nuse App\\Product;\n\nuse App\\Http\\Requests\\Balances\\StoreBalance;\nuse App\\Http\\Requests\\Balances\\UpdateBalance;\nuse App\\Http\\Requests\\Balances\\RemoveBalance;\n\nclass BalanceController extends Controller\n{\n /**\n * Create a new controller instance.\n *\n * @return void\n */\n public function __construct()\n {\n $this->middleware(['auth', 'user.id']);\n $this->middleware('permission:view_balance', ['only' => ['index', 'list']]);\n $this->middleware('permission:create_balance|create_transaction', ['only' => ['create']]);\n $this->middleware('permission:update_balance', ['only' => ['update']]);\n $this->middleware('permission:destroy_balance', ['only' => ['destroy']]);\n }\n\n public function index()\n {\n return view('balances.index');\n }\n\n public function list(Request $request)\n {\n return QueryBuilder::for(Balance::class)\n ->LeftJoin('products', 'balances.product_id', 'products.id')\n ->LeftJoin('merchants', 'balances.merchant_id', 'merchants.id')\n ->LeftJoin('offices', 'balances.office_id', 'offices.id')\n ->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')\n ->allowedFilters(\n 'balance',\n 'balances.id',\n 'expiry_date',\n 'products.amount_limit',\n 'balances.car_limit',\n 'products.name',\n 'balances.note',\n 'products.name',\n 'merchants.name',\n 'offices.name'\n )\n ->orderBy('id', 'desc')\n ->jsonPaginate();\n }\n\n\n /**\n * Create a new _balance instance after a valid registration.\n *\n * @param array $data\n * @return \\App\\Balance\n */\n protected function create(StoreBalance $request)\n {\n $\n $product = Product::findOrFail($request->product_id);\n if($product->requiresCarBalance() && !$request->filled('car_limit'))\n return ezReturnErrorMessage('Car Limit is required!');\n\n $balance = Balance::create($request->input());\n\n return ezReturnSuccessMessage('Balance created successfully!', $balance);\n }\n\n public function update(UpdateBalance $request)\n {\n $Balance = Balance::findOrFail($request->id);\n\n $Balance->update($request->input());\n\n return ezReturnSuccessMessage('Balance updated successfully!');\n }\n\n public function destroy(Request $request)\n {\n\n $Balance = Balance::findOrFail($request->id);\n\n $Balance->delete();\n\n return ezReturnSuccessMessage('Balance removed successfully!');\n\n }\n\n public function productBalance(Request $request){\n\n if(!$request->filled('product_name'))\n return;\n\n $balanceInfo = [\n 'product_requires_balance' =>null,\n 'rows' => []\n ];\n\n //Data template\n //[{name:'n11',value:'v12',editor:'text',group:'Product Information'}]\n\n $product = Product::where(['name' =>$request->product_name])->first();\n\n if($product == null)\n return $balanceInfo;\n\n $balanceInfo['product_requires_balance'] = $product->requiresBalance();\n\n $this->setProductInformation($product, $balanceInfo);\n $this->setCheckTypeInformation($product, $balanceInfo);\n return $balanceInfo;\n\n }\n\n function setProductInformation($product, &$balanceInfo)\n {\n if($product->requiresBalance())\n {\n $balanceInfo['product'] = $product;\n $balanceInfo['merchant'] = $product->requiresBalance();\n array_push($balanceInfo['rows'], ['name'=>'Name','value'=>$product->name,'group'=>'Product Information']);\n array_push($balanceInfo['rows'], ['name'=>'Requires Balance','value'=>'<span style=\"color:red; font-weight:bold;\">Yes</span>','group'=>'Product Information']);\n\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Has Amount Limit',\n 'value'=> $product->requiresAmountBalance() ? 'Yes' : 'No',\n 'group'=>'Product Information'\n ]);\n\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Has Car Limit',\n 'value'=> $product->requiresCarBalance() ? 'Yes' : 'No',\n 'group'=>'Product Information'\n ]);\n\n if($product->amount_limit != null){\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Amount Limit',\n 'value'=>$product->amount_limit . ' ' . $product->amount_limit_unit . '(s)',\n 'group'=>'Product Information'\n ]);\n }\n\n if($product->date_limit != null){\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Day Limit',\n 'value'=>'Expires in '.$product->date_limit. ' days',\n 'group'=>'Product Information'\n ]);\n }\n }\n else {\n array_push($balanceInfo['rows'],\n [\n 'name'=>'Requires Balance',\n 'value'=>'No',\n 'group'=>'Product Information'\n ]);\n return $balanceInfo;\n }\n }\n\n function setCheckTypeInformation($product, &$balanceInfo)\n {\n $checkTypes = \\App\\CheckType:: LeftJoin('product_check_type', 'product_check_type.check_type_id', 'check_types.id')\n ->selectRaw('id,category,subcategory,price')\n ->where('product_id', $product->id)->get();\n\n foreach($checkTypes as $checkType)\n {\n array_push($balanceInfo['rows'],\n [\n 'name'=>$checkType->category,\n 'value'=>$checkType->price,\n 'group'=>'Test Information'\n ]);\n }\n\n }\n\n\n}","offset":2218,"type":"php"}} []
[2018-12-16 10:38:34] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Statement\ClassDeclaration [] []
[2018-12-16 10:38:34] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Parameter [] []
[2018-12-16 10:38:34] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\CallExpression [] []
[2018-12-16 10:38:34] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\ScopedPropertyAccessExpression [] []
[2018-12-16 10:38:35] phpactor.DEBUG: Resolved type "<unknown>" for method "findOrFail" of class "App\Product" [] []
[2018-12-16 10:38:35] phpactor.DEBUG: Resolving: Microsoft\PhpParser\Node\Expression\Variable [] []
[2018-12-16 10:38:35] phpactor.DEBUG: RESPONSE {"action":"return","parameters":{"value":{"suggestions":[{"type":"variable","name":"$request","label":"$request","short_description":"StoreBalance","class_import":null,"info":"StoreBalance"},{"type":"variable","name":"$this","label":"$this","short_description":"BalanceController","class_import":null,"info":"BalanceController"}],"issues":[]}}} []
{
"version": "1.0.0",
"action": "return",
"parameters": {
"value": {
"suggestions": [
{
"type": "variable",
"name": "$request",
"label": "$request",
"short_description": "StoreBalance",
"class_import": null,
"info": "StoreBalance"
},
{
"type": "variable",
"name": "$this",
"label": "$this",
"short_description": "BalanceController",
"class_import": null,
"info": "BalanceController"
}
],
"issues": []
}
}
}%
and same error? have you also upgraded neovim recently or similar?
It was throwing an error so I upgraded neovim to follow HEAD since I thought I was missing some apis. However, nothing changes.
does any other RPC command work from within VIM? e.g. :call phpactor#Status()
Yes.
Info
----
Version: df27a0c (2 days ago) Adds-whatchanged-667
Work dir: /Users/juju/Development/Applications/neovim-qt/neovim-qt/build/bin
Diagnostics
-----------
[‚úî] XDebug is disabled. XDebug has a negative effect on performance.
[‚úò] Composer not found - some functionality will not be available (e.g. class creation) and class location will fallback to scanning the filesystem - this can be slow. Make sure you've run `composer install` in your project!
[‚úò] Git not detected. Some operations which would have been better scoped to your project repository will now include vendor paths.
Config files
------------
[‚úò] /Users/juju/.config/phpactor/phpactor.json
[‚úî] /Users/juju/.config/phpactor/phpactor.yml
[‚úò] /Users/juju/Projects/PHP/knights/.phpactor.json
[‚úò] /Users/juju/Projects/PHP/knights/.phpactor.yml
Work dir: /Users/juju/Development/Applications/neovim-qt/neovim-qt/build/bin
should be the root of your project, did you start VIM in your project root?
I am using neovim-qt. Let me try form terminal
It works in terminal :) But I have been using neovim-qt from its very early days. It never had such a probelm. Is there any way to set the path manually?
you can call :let g:phpactorInitialCwd=/path/to/your/project' if that works, I'm not sure what has changed to cause this to stop working in neovim-qt
Setting the directory manually fixes the issue. THANKS :)
However, I still think that when I cd into a directory, phpactor should pick the current path. This could be caused by neovim-qt as I upgraded that twoo
Ouch it just happened again :( status:
Info
----
Version: 5eb7190 (3 hours ago) adds-title-to-links-page
Work dir: /Volumes/MacOS/Users/juju/Projects/PHP/Knights
Diagnostics
-----------
[‚úî] Composer detected - faster class location and more features!
[‚úî] Git detected - enables faster refactorings in your repository scope!
[‚úî] XDebug is disabled. XDebug has a negative effect on performance.
Config files
------------
[‚úò] /Users/juju/.config/phpactor/phpactor.json
[‚úî] /Users/juju/.config/phpactor/phpactor.yml
[‚úò] /Users/juju/Projects/PHP/knights/app/Http/Controllers/.phpactor.json
[‚úò] /Users/juju/Projects/PHP/knights/app/Http/Controllers/.phpactor.yml
However, I still think that when I cd into a directory, phpactor should pick the current path.
Yeah ... you and others :) I repurposed this to address this: https://github.com/phpactor/phpactor/issues/660
Ouch it just happened again :(
Is that your project dir?
This happened even after setting the project dir manually
hmm, but this is only in nvim-qt? If so, I will have to try it I guess.
Nope it happens in termianl nvim too :(
I'm still curious about:
[php] syntax error, unexpected ')', expecting variable (T_VARIABLE) or '{' or '$'
It is shown by ALE (The linter). I think it is not related to phpactor.
The real problem for me is this. When this exception is thrown I have to press multiple keystrokes just to dismiss it. Then I press another letter and it happens again. When phpactor works, it works great. However, when it fails, it fails in a really disturbing way.
[ncm2_phpactor@yarp] error caught in notification handler 'on_complete
......................
....................
[ncm2_phpactor@yarp] Traceback (most re
[ncm2_phpactor@yarp] cent 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'