update deps & install rector

This commit is contained in:
Dominik Liebler
2019-12-14 12:50:05 +01:00
parent 04acce6759
commit 579a5ac946
87 changed files with 2432 additions and 786 deletions

View File

@@ -2,17 +2,14 @@
namespace DesignPatterns\Creational\StaticFactory;
use InvalidArgumentException;
/**
* Note1: Remember, static means global state which is evil because it can't be mocked for tests
* Note2: Cannot be subclassed or mock-upped or have multiple different instances.
*/
final class StaticFactory
{
/**
* @param string $type
*
* @return Formatter
*/
public static function factory(string $type): Formatter
{
if ($type == 'number') {
@@ -21,6 +18,6 @@ final class StaticFactory
return new FormatString();
}
throw new \InvalidArgumentException('Unknown format given');
throw new InvalidArgumentException('Unknown format given');
}
}