for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GolfLeague\Handlers;
use GolfLeague\Storage\HoleScore\HoleScoreRepository;
use \Hole;
/**
* MatchHandler Connection Class
*
* This class subscribes to events in related to match creation
* @author Michael Schmidt
*/
class RoundHandler
{
* Create a new instance of the MatchHandler
* @param GolfLeague\Storage\Round\RoundRepository $roundRepo
$roundRepo
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
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct(HoleScoreRepository $holescoreRepo)
$this->holescoreRepo= $holescoreRepo;
holescoreRepo
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
} // End of __construct
* Create an initial round for each player after a new match is created
* @param Match $match
$match
public function handle($round)
$holes = Hole::where('course_id', '=', $round['course_id'])->get();
foreach($holes as $hole){
$input = array(
'score' => null,
'hole_id' => $hole->id,
'round_id' => $round['id']
);
$this->holescoreRepo->create($input);
}
* Register the listeners for the subscriber.
* @param Illuminate\Events\Dispatcher $events
* @return array
public function subscribe($events)
$events->listen('eloquent.created: Round', 'GolfLeague\Handlers\RoundHandler');
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.