diff --git a/Patchwork.php b/Patchwork.php index 7408fcc..ac66da5 100644 --- a/Patchwork.php +++ b/Patchwork.php @@ -36,7 +36,7 @@ function relay(?array $args = null) function fallBack() { - throw new Exceptions\NoResult; + throw new Exceptions\NoResult(); } function restore(CallRerouting\Handle $handle) diff --git a/src/CallRerouting.php b/src/CallRerouting.php index d7f379f..c3a48fe 100644 --- a/src/CallRerouting.php +++ b/src/CallRerouting.php @@ -71,7 +71,7 @@ function instantiate(@parameters) { function connect($source, callable $target, ?Handle $handle = null, $partOfWildcard = false) { $source = translateIfLanguageConstruct($source); - $handle = $handle ?: new Handle; + $handle = $handle ?: new Handle(); list($class, $method) = Utils\interpretCallable($source); if (constitutesWildcard($source)) { return applyWildcard($source, $target, $handle); @@ -112,7 +112,7 @@ function constitutesWildcard($source) function applyWildcard($wildcard, callable $target, ?Handle $handle = null) { - $handle = $handle ?: new Handle; + $handle = $handle ?: new Handle(); list($class, $method, $instance) = Utils\interpretCallable($wildcard); if (!empty($instance)) { foreach (Utils\matchWildcard($method, get_class_methods($instance)) as $item) { @@ -181,7 +181,7 @@ function inPreprocessedFile($callable) function connectFunction($function, callable $target, ?Handle $handle = null) { - $handle = $handle ?: new Handle; + $handle = $handle ?: new Handle(); $routes = &State::$routes[''][$function]; $offset = Utils\append($routes, [$target, $handle]); $handle->addReference($routes[$offset]); @@ -190,7 +190,7 @@ function connectFunction($function, callable $target, ?Handle $handle = null) function queueConnection($source, callable $target, ?Handle $handle = null) { - $handle = $handle ?: new Handle; + $handle = $handle ?: new Handle(); $offset = Utils\append(State::$queue, [$source, $target, $handle]); $handle->addReference(State::$queue[$offset]); return $handle; @@ -213,7 +213,7 @@ function deployQueue() function connectMethod($function, callable $target, ?Handle $handle = null) { - $handle = $handle ?: new Handle; + $handle = $handle ?: new Handle(); list($class, $method, $instance) = Utils\interpretCallable($function); $target = new Decorator($target); $target->superclass = $class; @@ -235,9 +235,9 @@ function connectMethod($function, callable $target, ?Handle $handle = null) function connectInstantiation($class, callable $target, ?Handle $handle = null) { if (!Config\isNewKeywordRedefinable()) { - throw new Exceptions\NewKeywordNotRedefinable; + throw new Exceptions\NewKeywordNotRedefinable(); } - $handle = $handle ?: new Handle; + $handle = $handle ?: new Handle(); $class = strtr($class, ['\\' => '__']); $routes = &State::$routes["Patchwork\\Instantiators\\$class"]['instantiate']; $offset = Utils\append($routes, [$target, $handle]); @@ -318,7 +318,7 @@ function relay(?array $args = null) $route = &State::$routes[$class][$method][$offset]; $backup = $route; - $route = ['Patchwork\fallBack', new Handle]; + $route = ['Patchwork\fallBack', new Handle()]; $top = Stack\top(); if ($args === null) { $args = $top['args']; @@ -600,7 +600,7 @@ function getInstantiator($class, $calledClass) }); } $instantiator = "$namespace\\$adaptedName"; - return new $instantiator; + return new $instantiator(); } class State diff --git a/src/CodeManipulation/Source.php b/src/CodeManipulation/Source.php index db5d8c2..62521fb 100644 --- a/src/CodeManipulation/Source.php +++ b/src/CodeManipulation/Source.php @@ -303,7 +303,7 @@ function cache(array $args, \Closure $function) $result = &$this->cache; foreach (array_merge([$location], $args) as $step) { if (!is_scalar($step)) { - throw new \LogicException; + throw new \LogicException(); } if (!isset($result[$step])) { $result[$step] = []; diff --git a/src/CodeManipulation/Stream.php b/src/CodeManipulation/Stream.php index de8e28d..1977911 100644 --- a/src/CodeManipulation/Stream.php +++ b/src/CodeManipulation/Stream.php @@ -82,7 +82,7 @@ public static function getOtherWrapper($context) { if (isset(static::$otherWrapperClass)) { $class = static::$otherWrapperClass; - $otherWrapper = new $class; + $otherWrapper = new $class(); if ($context !== null) { $otherWrapper->context = $context; } diff --git a/src/Stack.php b/src/Stack.php index 3c467fa..d467a92 100644 --- a/src/Stack.php +++ b/src/Stack.php @@ -52,7 +52,7 @@ function top($property = null) function topOffset() { if (empty(State::$items)) { - throw new Exceptions\StackEmpty; + throw new Exceptions\StackEmpty(); } list($offset, $calledClass) = end(State::$items); return $offset; @@ -61,7 +61,7 @@ function topOffset() function topCalledClass() { if (empty(State::$items)) { - throw new Exceptions\StackEmpty; + throw new Exceptions\StackEmpty(); } list($offset, $calledClass) = end(State::$items); return $calledClass; @@ -70,7 +70,7 @@ function topCalledClass() function topArgsOverride() { if (empty(State::$items)) { - throw new Exceptions\StackEmpty; + throw new Exceptions\StackEmpty(); } list($offset, $calledClass, $argsOverride) = end(State::$items); return $argsOverride; diff --git a/tests/includes/InheritanceWithAssertions.php b/tests/includes/InheritanceWithAssertions.php index 23e867f..c85e617 100644 --- a/tests/includes/InheritanceWithAssertions.php +++ b/tests/includes/InheritanceWithAssertions.php @@ -37,7 +37,7 @@ function getBar() Patchwork\CallRerouting\deployQueue(); $foo = new FooObject; -$bar = new BarObject; +$bar = new BarObject(); $baz = new BazObject; assert($foo->getFoo() === "foo"); diff --git a/tests/includes/RedefinitionOfNewWithUse.php b/tests/includes/RedefinitionOfNewWithUse.php index ccce503..2701fea 100644 --- a/tests/includes/RedefinitionOfNewWithUse.php +++ b/tests/includes/RedefinitionOfNewWithUse.php @@ -19,7 +19,7 @@ public function testMethod() return 'test2'; }); - $test = new TestClass; + $test = new TestClass(); assert($test->testMethod() === 'test2'); } diff --git a/tests/includes/Singleton.php b/tests/includes/Singleton.php index eddc328..c91e5a6 100644 --- a/tests/includes/Singleton.php +++ b/tests/includes/Singleton.php @@ -6,7 +6,7 @@ static function getInstance() { static $instance = null; if (!isset($instance)) { - $instance = new self; + $instance = new self(); } return $instance; }