for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Olssonm\IdentityNumber;
/**
* Static helper-class for accessing the validation methods statically
*/
class Pin
{
* Main method used for validation, acts as a static helper
*
* @param string $number the number
* @param string $type what type of validator to use
* @return boolean
public static function isValid($number, $type = 'identity')
switch ($type) {
case 'identity':
$validator = new IdentityNumber();
return $validator->isValid($number);
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
return
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case
case 'organization':
$validator = new OrganizationNumber();
case 'coordination':
$validator = new CoordinationNumber();
}
return false;
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.