for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nip\Inflector\Traits;
/**
* Trait InflectionOrdinalizeTrait
* @package Nip\Inflector\Traits
*
* @method ordinalize($string)
*/
trait InflectionOrdinalizeTrait
{
* @param $number
* @return string
protected function doOrdinalize($number)
if (in_array(($number % 100), range(11, 13))) {
return $number . 'th';
} else {
switch (($number % 10)) {
case 1:
return $number . 'st';
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 2:
return $number . 'nd';
case 3:
return $number . 'rd';
default:
}
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.