for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace JPBernius\FMeat\Entities;
use ArrayIterator;
use IteratorAggregate;
use Traversable;
/**
* Class Year
* @package JPBernius\FMeat\Entities
*/
class Year implements Entity, IteratorAggregate
{
/** @var int */
private $yearNumber;
/** @var array */
private $weeks = [];
* Year constructor.
* @param int|null $yearNumber
public function __construct(int $yearNumber = null)
if (is_null($yearNumber)) {
$yearNumber = intval(date("Y"));
}
$this->yearNumber = $yearNumber;
* @param string $jsonString
$jsonString
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 Year
public static function fromJson(\stdClass $jsonObject): self
return new Year($jsonObject->year);
* @return mixed
public function getYearNumber(): int
return $this->yearNumber;
* @param Week $week
public function addWeek(Week $week): void
$this->weeks[$week->getWeekNumber() - 1] = $week;
* @param int $weekNumber
* @return Week
public function getWeek(int $weekNumber): Week
if (empty($this->weeks[$weekNumber])) {
return null;
return $this->weeks[$weekNumber];
* Retrieve an external iterator
* @link http://php.net/manual/en/iteratoraggregate.getiterator.php
* @return Traversable An instance of an object implementing <b>Iterator</b> or
* <b>Traversable</b>
* @since 5.0.0
public function getIterator(): Traversable
return new ArrayIterator($this->weeks);
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 methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.