-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added type hint for
Debug::getRefCount()
which only support object.…
… (#4429) * Added type hint for `Debug::getRefCount()` which only support object. * Update CHANGELOG-2.2.md
- Loading branch information
1 parent
b279d33
commit 1786dcc
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace HyperfTest\Testing; | ||
|
||
use Hyperf\Testing\Debug; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @internal | ||
* @coversNothing | ||
*/ | ||
class DebugTest extends TestCase | ||
{ | ||
public function testGetRefCount() | ||
{ | ||
$this->assertSame('1', Debug::getRefCount(new \stdClass())); | ||
$obj = new \stdClass(); | ||
$this->assertSame('2', Debug::getRefCount($obj)); | ||
$obj2 = new \stdClass(); | ||
$obj2->obj = $obj; | ||
$this->assertSame('2', Debug::getRefCount($obj2)); | ||
$this->assertSame('3', Debug::getRefCount($obj)); | ||
$fun = static function () {}; | ||
$this->assertSame('2', Debug::getRefCount($fun)); | ||
$this->assertSame('1', Debug::getRefCount(function () {})); | ||
} | ||
} |