for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Bedard\Shop\Models;
use Model;
/**
* Cart Model.
*/
class Cart extends Model
{
* @var string The database table used by the model.
public $table = 'bedard_shop_carts';
* @var array Default attributes
public $attributes = [
'id' => null,
];
* @var array Guarded fields
protected $guarded = ['*'];
* @var array Fillable fields
protected $fillable = [
'token',
* @var array Relations
public $belongsTo = [
'promotion' => [
'Bedard\Shop\Models\Promotion',
],
public $hasMany = [
'items' => [
'Bedard\Shop\Models\CartItem',
* Apply a promotion to the cart.
*
* @param string $code The promotion code to apply.
$code
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @return void
public function applyPromotion($name)
$promotion = Promotion::isActive()->whereName($name)->firstOrFail();
$this->promotion_id = $promotion->id;
$this->save();
}
* Before create.
public function beforeCreate()
$this->generateToken();
* Generate a unique token.
protected function generateToken()
do {
$this->token = str_random(40);
} while (self::whereToken($this->token)->exists());
* Select carts that are open.
* @param \October\Rain\Database\Builder $query
* @return \October\Rain\Database\Builder
public function scopeIsOpen($query)
return $query; // @todo
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.