I was wondering if there is some way to ignore warning generated by PHP_CodeSniffer which refer to Eloquent mappings.
For example:
/**
* @param User $user
* @param string $message
* @param string $type
* @return Comment
* @throws Exception
*/
public function createComment(User $user, $message, $type)
{
$comment = new Comment();
$comment->creator()->associate($user);
$comment->Message = $message; //PHPCS warning: Property accessed via magic method
$comment->AddedDate = new Carbon();
$comment->Type = $type;
$comment->save();
return $comment;
}
P.S: I wouldn't want to exclude this warnings that are not related to Models (keep them for other class tipes), and preferably exclude setters and getters fora each property
If "Comment" is a Model you have created, add class phpDoc comments to hint the IDE about the properties available.
/**
* Class Comment
* @property int id
* @property string Message
*/
class Comment extends Model {
This is good for auto-complete as well