for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ElfSundae\Laravel\Support\Constants;
class Sex
{
const UNKNOWN = 0;
const MALE = 1;
const FEMALE = 2;
/**
* Convert a sex constants to string.
*
* @param int $sex
* @return string|null
*/
public static function string($sex)
if ($sex === static::MALE) {
return '男';
} elseif ($sex === static::FEMALE) {
return '女';
}
* Convert a sex string to int type.
* @param mixed $string
$string
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 int
public static function type($sex)
if ($sex == '男') {
return static::MALE;
} elseif ($sex == '女') {
return static::FEMALE;
return static::UNKNOWN;
* All sex types.
* @return int[]
public static function allTypes()
return [static::MALE, static::FEMALE];
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.