for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kata\GildedRoseKata;
final class ItemFactory
{
public static function fromItem(Item $item)
switch($item->name)
case AgedBrieItem::ITEM_NAME:
return new AgedBrieItem($item);
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
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 SulfurasItem::ITEM_NAME:
return new SulfurasItem($item);
case BackstagePassItem::ITEM_NAME:
return new BackstagePassItem($item);
case ConjuredItem::ITEM_NAME:
return new ConjuredItem($item);
default:
return new BaseItem($item);
}
The break statement is not necessary if it is preceded for example by a return 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.