Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 4740389

Browse files
author
Andrey Helldar
committed
Fixed collision
1 parent 3c2eb8e commit 4740389

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/Services/Parser.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function split(string $value): array
6868
protected function push(string $key, $value): void
6969
{
7070
if (! isset($this->keys[$key])) {
71-
$this->keys[$key] = $value;
71+
$this->keys[$key] = $this->isKeyCollision($value) ? null : $value;
7272
}
7373
}
7474

@@ -79,6 +79,11 @@ protected function subkey(string $value): string
7979
return trim($sub_key, " \t\n\r\0\x0B,()");
8080
}
8181

82+
protected function isKeyCollision($value): bool
83+
{
84+
return Str::contains((string) $value, ['(', ')', '\'', '"']);
85+
}
86+
8287
protected function keys(): array
8388
{
8489
return $this->keys;

tests/fixtures/laravel/expected-config

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ DYNAMODB_CACHE_TABLE=cache
3535
DYNAMODB_ENDPOINT=null
3636

3737
DB_CONNECTION=mysql
38-
DB_DATABASE=database_path('database.sqlite')
38+
DB_DATABASE=forge
3939
DB_FOREIGN_KEYS=null
4040
DB_HOST=foo
4141
DB_PASSWORD=null

tests/fixtures/native/expected-config

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ DYNAMODB_CACHE_TABLE=cache
3535
DYNAMODB_ENDPOINT=null
3636

3737
DB_CONNECTION=mysql
38-
DB_DATABASE=database_path('database.sqlite')
38+
DB_DATABASE=forge
3939
DB_FOREIGN_KEYS=null
4040
DB_HOST=foo
4141
DB_PASSWORD=null

0 commit comments

Comments
 (0)