forked from aternosorg/taskmaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnChild.php
27 lines (23 loc) · 1018 Bytes
/
OnChild.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace Aternos\Taskmaster\Task;
use Attribute;
/**
* Class OnChild
*
* This attribute can be used to mark a method or property in your {@link Task} to only be used on the child process.
*
* Methods marked with this attribute cannot be called using the {@link Task::callAsync()} and
* {@link Task::call()} methods. This causes a {@link RuntimeException} to be thrown.
*
* Properties marked with this attribute are initially serialized on the parent process and send to the child process.
* They are available in your {@link Task::run()} method, but are not send back to the parent process during
* {@link Task::callAsync()} and {@link Task::call()} calls or when the task is finished.
* Therefore, you can set them to unserializable values in your {@link Task::run()}, e.g. closures or resources, but
* they must be serializable initially, e.g. empty/uninitialized.
*
* @package Aternos\Taskmaster\Task
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY)]
class OnChild
{
}