From 7ebfba1c8e2c8a18d3792e716257cbc8f33a55a8 Mon Sep 17 00:00:00 2001 From: Kasper Hansen Date: Mon, 18 Aug 2025 18:32:28 +0200 Subject: [PATCH] Remove obsolete check for 'version' in docker compose file --- src/Util/ComposeFileManipulator.php | 15 --------------- tests/Util/ComposeFileManipulatorTest.php | 22 ---------------------- 2 files changed, 37 deletions(-) diff --git a/src/Util/ComposeFileManipulator.php b/src/Util/ComposeFileManipulator.php index b619ef19b..b7a202d71 100644 --- a/src/Util/ComposeFileManipulator.php +++ b/src/Util/ComposeFileManipulator.php @@ -38,8 +38,6 @@ public function __construct(string $contents) } else { $this->manipulator = new YamlSourceManipulator($contents); } - - $this->checkComposeFileVersion(); } public function getComposeData(): array @@ -116,17 +114,4 @@ private function getBasicStructure(string $version = self::COMPOSE_FILE_VERSION) 'services' => [], ]; } - - private function checkComposeFileVersion(): void - { - $data = $this->manipulator->getData(); - - if (empty($data['version'])) { - throw new RuntimeCommandException('compose.yaml file version is not set.'); - } - - if (2.0 > (float) $data['version']) { - throw new RuntimeCommandException(\sprintf('compose.yaml version %s is not supported. Please update your compose.yaml file to the latest version.', $data['version'])); - } - } } diff --git a/tests/Util/ComposeFileManipulatorTest.php b/tests/Util/ComposeFileManipulatorTest.php index aaec271d5..44a9c4d07 100644 --- a/tests/Util/ComposeFileManipulatorTest.php +++ b/tests/Util/ComposeFileManipulatorTest.php @@ -140,26 +140,4 @@ public function testAddVolume(): void self::assertSame($expected, $manipulator->getComposeData()); } - - public function testCheckComposeFileVersion(): void - { - new ComposeFileManipulator('version: \'2\''); - - $this->expectException(RuntimeCommandException::class); - $this->expectExceptionMessage('compose.yaml version 1.9 is not supported. Please update your compose.yaml file to the latest version.'); - - new ComposeFileManipulator('version: \'1.9\''); - } - - public function testCheckComposeFileVersionThrowsExceptionWithMissingVersion(): void - { - $composeFile = <<< 'EOT' - services: - [] - EOT; - $this->expectException(RuntimeCommandException::class); - $this->expectExceptionMessage('compose.yaml file version is not set.'); - - new ComposeFileManipulator($composeFile); - } }