Skip to content

Commit 7ebfba1

Browse files
author
Kasper Hansen
committed
Remove obsolete check for 'version' in docker compose file
1 parent c86da84 commit 7ebfba1

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

src/Util/ComposeFileManipulator.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public function __construct(string $contents)
3838
} else {
3939
$this->manipulator = new YamlSourceManipulator($contents);
4040
}
41-
42-
$this->checkComposeFileVersion();
4341
}
4442

4543
public function getComposeData(): array
@@ -116,17 +114,4 @@ private function getBasicStructure(string $version = self::COMPOSE_FILE_VERSION)
116114
'services' => [],
117115
];
118116
}
119-
120-
private function checkComposeFileVersion(): void
121-
{
122-
$data = $this->manipulator->getData();
123-
124-
if (empty($data['version'])) {
125-
throw new RuntimeCommandException('compose.yaml file version is not set.');
126-
}
127-
128-
if (2.0 > (float) $data['version']) {
129-
throw new RuntimeCommandException(\sprintf('compose.yaml version %s is not supported. Please update your compose.yaml file to the latest version.', $data['version']));
130-
}
131-
}
132117
}

tests/Util/ComposeFileManipulatorTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,4 @@ public function testAddVolume(): void
140140

141141
self::assertSame($expected, $manipulator->getComposeData());
142142
}
143-
144-
public function testCheckComposeFileVersion(): void
145-
{
146-
new ComposeFileManipulator('version: \'2\'');
147-
148-
$this->expectException(RuntimeCommandException::class);
149-
$this->expectExceptionMessage('compose.yaml version 1.9 is not supported. Please update your compose.yaml file to the latest version.');
150-
151-
new ComposeFileManipulator('version: \'1.9\'');
152-
}
153-
154-
public function testCheckComposeFileVersionThrowsExceptionWithMissingVersion(): void
155-
{
156-
$composeFile = <<< 'EOT'
157-
services:
158-
[]
159-
EOT;
160-
$this->expectException(RuntimeCommandException::class);
161-
$this->expectExceptionMessage('compose.yaml file version is not set.');
162-
163-
new ComposeFileManipulator($composeFile);
164-
}
165143
}

0 commit comments

Comments
 (0)