for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Model class
*
* Base class for an ORM.
* @package core
* @author [email protected]
* @copyright Caffeina srl - 2015 - http://caffeina.it
*/
abstract class Model {
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.
use Module, Persistence, Events;
public static function where($where_sql = false, $params = [], $flush = false){
$flush
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$key = static::persistenceOptions('key');
return SQL::reduce("SELECT {$key} FROM " . static::persistenceOptions('table') . ($where_sql ? " where {$where_sql}" : ''), $params, function($results, $row) use ($key) {
$results[] = static::load($row->{$key});
return $results;
}, []);
}
public static function count($where_sql = false, $params = []) {
return SQL::value('SELECT COUNT(1) FROM ' . static::persistenceOptions('table') . ($where_sql ? " where {$where_sql}" : ''), $params);
public static function all($page=1, $limit=-1){
return static::where($limit < 1 ? "" : "1 limit {$limit} offset " . (max(1,$page)-1)*$limit);
$limit < 1 ? '' : "1 lim...1, $page) - 1) * $limit
string
boolean
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
public function primaryKey(){
return $this->{$key};
public static function create($data){
$tmp = new static;
foreach ((array)$data as $key => $value) {
$tmp->$key = $value;
$tmp->save();
return $tmp;
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.