Rename Fiber::this() to Fiber::getCurrent() (#7155)

This commit is contained in:
Aaron Piotrowski 2021-06-18 11:02:02 -05:00 committed by GitHub
parent c5f9cdedd6
commit 865fb353f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 13 deletions

View File

@ -1,12 +1,12 @@
--TEST--
Fiber::this()
Fiber::getCurrent()
--FILE--
<?php
var_dump(Fiber::this());
var_dump(Fiber::getCurrent());
$fiber = new Fiber(function (): void {
var_dump(Fiber::this());
var_dump(Fiber::getCurrent());
});
$fiber->start();

View File

@ -4,7 +4,7 @@ Fiber status methods
<?php
$fiber = new Fiber(function (): void {
$fiber = Fiber::this();
$fiber = Fiber::getCurrent();
echo "\nWithin Fiber:\n";
var_dump($fiber->isStarted());
var_dump($fiber->isRunning());

View File

@ -4,7 +4,7 @@ Resume previous fiber
<?php
$fiber = new Fiber(function (): void {
$fiber1 = Fiber::this();
$fiber1 = Fiber::getCurrent();
$fiber2 = new Fiber(function () use ($fiber1): void {
$fiber1->resume();

View File

@ -4,7 +4,7 @@ Resume running fiber
<?php
$fiber = new Fiber(function (): void {
$self = Fiber::this();
$self = Fiber::getCurrent();
$self->resume();
});

View File

@ -796,7 +796,7 @@ ZEND_METHOD(Fiber, getReturn)
RETURN_THROWS();
}
ZEND_METHOD(Fiber, this)
ZEND_METHOD(Fiber, getCurrent)
{
ZEND_PARSE_PARAMETERS_NONE();

View File

@ -23,7 +23,7 @@ final class Fiber
public function getReturn(): mixed {}
public static function this(): ?Fiber {}
public static function getCurrent(): ?Fiber {}
public static function suspend(mixed $value = null): mixed {}
}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 5f63019ce24efa7b5426f172d68a0f9f705a3bd5 */
* Stub hash: 7a3a7030f97d2c1e787499ef25341607841a607c */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Fiber___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
@ -29,7 +29,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Fiber_getReturn, 0, 0, IS_MIXED, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Fiber_this, 0, 0, Fiber, 1)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Fiber_getCurrent, 0, 0, Fiber, 1)
ZEND_END_ARG_INFO()
#define arginfo_class_Fiber_suspend arginfo_class_Fiber_resume
@ -47,7 +47,7 @@ ZEND_METHOD(Fiber, isSuspended);
ZEND_METHOD(Fiber, isRunning);
ZEND_METHOD(Fiber, isTerminated);
ZEND_METHOD(Fiber, getReturn);
ZEND_METHOD(Fiber, this);
ZEND_METHOD(Fiber, getCurrent);
ZEND_METHOD(Fiber, suspend);
ZEND_METHOD(FiberError, __construct);
@ -62,7 +62,7 @@ static const zend_function_entry class_Fiber_methods[] = {
ZEND_ME(Fiber, isRunning, arginfo_class_Fiber_isRunning, ZEND_ACC_PUBLIC)
ZEND_ME(Fiber, isTerminated, arginfo_class_Fiber_isTerminated, ZEND_ACC_PUBLIC)
ZEND_ME(Fiber, getReturn, arginfo_class_Fiber_getReturn, ZEND_ACC_PUBLIC)
ZEND_ME(Fiber, this, arginfo_class_Fiber_this, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_ME(Fiber, getCurrent, arginfo_class_Fiber_getCurrent, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_ME(Fiber, suspend, arginfo_class_Fiber_suspend, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};

View File

@ -4,7 +4,7 @@ ReflectionFiber basic tests
<?php
$callable = function (): void {
$reflection = new ReflectionFiber(Fiber::this());
$reflection = new ReflectionFiber(Fiber::getCurrent());
echo "\nWithin Fiber:\n";
var_dump($reflection->getExecutingFile());
var_dump($reflection->getExecutingLine());