Skip to content

Commit

Permalink
fix scalar values
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Feb 8, 2025
1 parent eec16a2 commit 1ebaa41
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Drivers/PhpDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function toFile(array $values): string
}

/**
* @param array<array-key, scalar|scalar[]> $items
* @param array<array-key, null|scalar|array<array-key, null|scalar>> $items
*/
public function recursiveToFile(
array $items,
Expand All @@ -157,6 +157,12 @@ public function recursiveToFile(

if (is_string($value)) {
$value = "'".str_replace('\"', '"', addslashes($value))."'";
} elseif (is_null($value)) {
$value = 'null';
} elseif (is_bool($value)) {
$value = $value ? 'true' : 'false';
} else {
$value = (string) $value;
}

if (is_string($key)) {
Expand Down

0 comments on commit 1ebaa41

Please sign in to comment.