77## host()
88
99``` php
10- host(string ...$hostname)
10+ host(string ...$hostname): Host
1111```
1212
1313Defines a host or hosts.
@@ -24,13 +24,18 @@ task('test', function () {
2424```
2525
2626
27-
2827## localhost()
2928
3029``` php
31- localhost(string ...$hostnames)
30+ localhost(string ...$hostnames): Localhost
3231```
3332
33+ Define a local host.
34+ Deployer will not connect to this host, but will execute commands locally instead.
35+
36+ ``` php
37+ localhost('ci'); // Alias and hostname will be "ci".
38+ ```
3439
3540
3641## currentHost()
@@ -85,7 +90,6 @@ import(__DIR__ . '/config/hosts.yaml');
8590```
8691
8792
88-
8993## desc()
9094
9195``` php
@@ -98,7 +102,7 @@ Set task description.
98102## task()
99103
100104``` php
101- task(string $name, $body = null): Task
105+ task(string $name, ?callable $body = null): Task
102106```
103107
104108Define a new task and save to tasks list.
@@ -110,12 +114,12 @@ Alternatively get a defined task.
110114| Argument | Type | Comment |
111115| ---| ---| ---|
112116| ` $name ` | ` string ` | Name of current task. |
113- | ` $body ` | ` callable():void ` or ` array ` or ` null ` | Callable task, array of other tasks names or nothing to get a defined tasks |
117+ | ` $body ` | ` ? callable` | Callable task, array of other tasks names or nothing to get a defined tasks |
114118
115119## before()
116120
117121``` php
118- before(string $task, $do)
122+ before(string $task, string|callable $do): ?Task
119123```
120124
121125Call that task before specified task runs.
@@ -126,12 +130,12 @@ Call that task before specified task runs.
126130| Argument | Type | Comment |
127131| ---| ---| ---|
128132| ` $task ` | ` string ` | The task before $that should be run. |
129- | ` $do ` | ` string ` or ` callable():void ` | The task to be run. |
133+ | ` $do ` | ` string ` or ` callable ` | The task to be run. |
130134
131135## after()
132136
133137``` php
134- after(string $task, $do)
138+ after(string $task, string|callable $do): ?Task
135139```
136140
137141Call that task after specified task runs.
@@ -142,12 +146,12 @@ Call that task after specified task runs.
142146| Argument | Type | Comment |
143147| ---| ---| ---|
144148| ` $task ` | ` string ` | The task after $that should be run. |
145- | ` $do ` | ` string ` or ` callable():void ` | The task to be run. |
149+ | ` $do ` | ` string ` or ` callable ` | The task to be run. |
146150
147151## fail()
148152
149153``` php
150- fail(string $task, $do)
154+ fail(string $task, string|callable $do): ?Task
151155```
152156
153157Setup which task run on failure of $task.
@@ -159,7 +163,7 @@ When called multiple times for a task, previous fail() definitions will be overr
159163| Argument | Type | Comment |
160164| ---| ---| ---|
161165| ` $task ` | ` string ` | The task which need to fail so $that should be run. |
162- | ` $do ` | ` string ` or ` callable():void ` | The task to be run. |
166+ | ` $do ` | ` string ` or ` callable ` | The task to be run. |
163167
164168## option()
165169
@@ -187,6 +191,11 @@ cd(string $path): void
187191
188192Change the current working directory.
189193
194+ ``` php
195+ cd('~/myapp');
196+ run('ls'); // Will run `ls` in ~/myapp.
197+ ```
198+
190199
191200## become()
192201
@@ -210,7 +219,7 @@ $restore(); // revert back to the previous user
210219## within()
211220
212221``` php
213- within(string $path, callable $callback)
222+ within(string $path, callable $callback): mixed
214223```
215224
216225Execute a callback within a specific directory and revert back to the initial working directory.
@@ -220,7 +229,15 @@ Execute a callback within a specific directory and revert back to the initial wo
220229## run()
221230
222231``` php
223- run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
232+ run(
233+ string $command,
234+ ?int $timeout = null,
235+ ?int $idle_timeout = null,
236+ ?string $secret = null,
237+ ?array $env = null,
238+ ?bool $real_time_output = false,
239+ ?bool $no_throw = false,
240+ ): string
224241```
225242
226243Executes given command on remote host.
@@ -245,7 +262,6 @@ run("echo $path");
245262| Argument | Type | Comment |
246263| ---| ---| ---|
247264| ` $command ` | ` string ` | Command to run on remote host. |
248- | ` $options ` | ` array ` or ` null ` | Array of options will override passed named arguments. |
249265| ` $timeout ` | ` int ` or ` null ` | Sets the process timeout (max. runtime). The timeout in seconds (default: 300 sec; see {{default_timeout}}, ` null ` to disable). |
250266| ` $idle_timeout ` | ` int ` or ` null ` | Sets the process idle timeout (max. time since last output) in seconds. |
251267| ` $secret ` | ` string ` or ` null ` | Placeholder ` %secret% ` can be used in command. Placeholder will be replaced with this value and will not appear in any logs. |
0 commit comments