Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Patchwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function relay(?array $args = null)

function fallBack()
{
throw new Exceptions\NoResult;
throw new Exceptions\NoResult();
}

function restore(CallRerouting\Handle $handle)
Expand Down
18 changes: 9 additions & 9 deletions src/CallRerouting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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]);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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]);
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -600,7 +600,7 @@ function getInstantiator($class, $calledClass)
});
}
$instantiator = "$namespace\\$adaptedName";
return new $instantiator;
return new $instantiator();
}

class State
Expand Down
2 changes: 1 addition & 1 deletion src/CodeManipulation/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/CodeManipulation/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/includes/InheritanceWithAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tests/includes/RedefinitionOfNewWithUse.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testMethod()
return 'test2';
});

$test = new TestClass;
$test = new TestClass();

assert($test->testMethod() === 'test2');
}
2 changes: 1 addition & 1 deletion tests/includes/Singleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ static function getInstance()
{
static $instance = null;
if (!isset($instance)) {
$instance = new self;
$instance = new self();
}
return $instance;
}
Expand Down