for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Propaganistas\LaravelPhone\Exceptions;
use Illuminate\Support\Str;
use libphonenumber\NumberParseException as libNumberParseException;
class NumberParseException extends libNumberParseException
{
/**
* @var string
*/
protected $number;
* @var array
protected $countries = [];
* Country specification required static constructor.
*
* @param string $number
* @return static
public static function countryRequired($number)
$exception = new static(
libNumberParseException::INVALID_COUNTRY_CODE,
'Number requires a country to be specified.'
);
$exception->number = $number;
return $exception;
}
* Country mismatch static constructor.
* @param string|array $country
$country
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.
public static function countryMismatch($number, $countries)
$countries = array_filter(is_array($countries) ? $countries : [$countries]);
'Number does not match the provided '. Str::plural('country', count($countries)).'.'
$exception->countries = $countries;
* @return string
public function getNumber()
return $this->number;
* @return array
public function getCountries()
return $this->countries;
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.