Skip to content

Commit 101b76a

Browse files
authored
Merge pull request #10 from jedymatt/9-detected-duplicate-mysql-services
Detect services with only preceding whitespace and not include any whitespace character
2 parents 09d9c3d + ebf4069 commit 101b76a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Console/SailEnvCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function getServicesFromDockerCompose(): array
5959
$dockerComposeContent = file_get_contents($this->laravel->basePath('docker-compose.yml'));
6060

6161
$regex = '/'.implode('|', array_map(function ($service) {
62-
return '(?<=\s)'.$service.'(?=:)'; // Match service name followed by ':' (e.g. mysql:) and preceded by whitespace
62+
return '(?<=[^\S]\s)'.$service.'(?=:)'; // Match service name followed by ':' (e.g. mysql:) and preceded only by whitespace
6363
}, $this->services)).'/';
6464

6565
preg_match_all($regex, $dockerComposeContent, $matches);

0 commit comments

Comments
 (0)