for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Slim\Slim;
class Xhgui_Controller_Import extends Xhgui_Controller
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
/**
* @var Xhgui_Saver_Mongo
*/
private $saver;
public function __construct(Slim $app, Xhgui_Saver_Mongo $saver)
$this->app = $app;
$this->saver = $saver;
}
public function import()
$request = $this->app->request();
$response = $this->app->response();
$data = json_decode($request->getBody(), true);
$this->saver->save($data);
$response['Content-Type'] = 'application/json';
$response->body(json_encode(['ok' => true]));
body
$response
array<string,string,{"Content-Type":"string"}>
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.