Skip to content

Commit 34bd2da

Browse files
committed
add comment
Signed-off-by: Kang HuaiShuai <khs1994@khs1994.com>
1 parent fb1cdd7 commit 34bd2da

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/Docker/Container/Client.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,13 @@ class Client
531531

532532
/**
533533
* @param array $cmd [ "nginx", "-g", "daemon off;"]
534+
* null => 默认值,Dockerfile 中指定的值
535+
* [] => 默认值,Dockerfile 中指定的值
536+
* [""] => ""
534537
*
535538
* @return Client
536539
*/
537-
public function setCmd(?array $cmd)
540+
public function setCmd(?array $cmd = null)
538541
{
539542
$this->cmd = $cmd;
540543

@@ -820,10 +823,13 @@ public function setWorkingDir(string $workingDir)
820823

821824
/**
822825
* @param array $entrypoint ['/bin/sh', '-c']
826+
* [] => []
827+
* null => 默认值,Dockerfile 中指定的值
828+
* [""] => null
823829
*
824830
* @return Client
825831
*/
826-
public function setEntrypoint(?array $entrypoint)
832+
public function setEntrypoint(?array $entrypoint = null)
827833
{
828834
$this->entrypoint = $entrypoint;
829835

tests/Docker/Container/ClientTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testList(): void
3535
public function testCreate()
3636
{
3737
$output = $this->client
38-
->setImage('khs1994/nginx:1.15.3-alpine')
38+
->setImage('nginx:1.17.3-alpine')
3939
->setEnv(['a=1'])
4040
->setBinds(['/c:/c'])
4141
->setPortBindings([
@@ -47,6 +47,8 @@ public function testCreate()
4747
],
4848
])
4949
->setLabels(['a' => '1'])
50+
->setEntrypoint(null)
51+
->setCmd(null)
5052
->create()
5153
->start(null);
5254

tests/Docker/Distribution/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function setUp(): void
2424
*/
2525
public function testInfo(): void
2626
{
27-
$output = $this->client->info('khs1994/nginx');
27+
$output = $this->client->info('nginx');
2828

2929
$this->assertArrayHasKey('Descriptor', json_decode($output, true));
3030
}

0 commit comments

Comments
 (0)