Skip to content

Commit

Permalink
Test that keeps parenthesis around anonymous class parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
wvega committed Feb 7, 2022
1 parent dbe712f commit ba1f6da
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/includes/RedefinitionOfNewAsAnonymousClassParameter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Foo
{
class TestClass
{
}
}

namespace Bar
{
use Foo\TestClass;
use stdClass;

\Patchwork\redefine('new Foo\TestClass', \Patchwork\always(new stdClass));

$test = new class(new TestClass()) {
public $object;

public function __construct($object)
{
$this->object = $object;
}
};

assert($test->object instanceof stdClass);
}
20 changes: 20 additions & 0 deletions tests/redefine-new-anonymous-class-paramter.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
https://github.com/antecedent/patchwork/issues/127

--FILE--
<?php

assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
error_reporting(E_ALL | E_STRICT);

$_SERVER['PHP_SELF'] = __FILE__;

require __DIR__ . "/../Patchwork.php";
require __DIR__ . "/includes/RedefinitionOfNewAsAnonymousClassParameter.php";

?>
===DONE===

--EXPECT--
===DONE===

0 comments on commit ba1f6da

Please sign in to comment.