Skip to content

Commit 2b6d358

Browse files
committed
feat: propagate faker properties
1 parent 8cbdafa commit 2b6d358

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Core/Fake/Faker.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class Faker extends Engine implements Contract
198198
public function __construct(
199199
Notation $case = Notation::SNAKE,
200200
array $formatters = [],
201-
?string $locale = null,
201+
private readonly ?string $locale = null,
202202
private readonly bool $ignoreFromDefaultValue = false,
203203
) {
204204
parent::__construct($case, $formatters);
@@ -246,17 +246,22 @@ private function resolveParameters(array $parameters, Set $presets): Set
246246
$values = [];
247247
$fromDefaultValue = $this->ignoreFromDefaultValue
248248
? null
249-
: new FromDefaultValue($this->notation, $this->formatters);
249+
: new FromDefaultValue($this->notation, $this->formatters, $this->locale);
250250
foreach ($parameters as $parameter) {
251251
$field = $this->casedField($parameter);
252-
$generated = (new FromDependency($this->notation, $this->formatters))
253-
->then(new FromTypeDate($this->notation, $this->formatters))
254-
->then(new FromCollection($this->notation, $this->formatters))
255-
->then(new FromTypeBuiltin($this->notation, $this->formatters))
256-
->then(new FromTypeAttributes($this->notation, $this->formatters))
257-
->then(new FromEnum($this->notation, $this->formatters))
252+
$generated = (new FromDependency(
253+
$this->notation,
254+
$this->formatters,
255+
$this->locale,
256+
$this->ignoreFromDefaultValue
257+
))
258+
->then(new FromTypeDate($this->notation, $this->formatters, $this->locale))
259+
->then(new FromCollection($this->notation, $this->formatters, $this->locale))
260+
->then(new FromTypeBuiltin($this->notation, $this->formatters, $this->locale))
261+
->then(new FromTypeAttributes($this->notation, $this->formatters, $this->locale))
262+
->then(new FromEnum($this->notation, $this->formatters, $this->locale))
258263
->then($fromDefaultValue)
259-
->then(new FromPreset($this->notation, $this->formatters))
264+
->then(new FromPreset($this->notation, $this->formatters, $this->locale))
260265
->resolve($parameter, $presets);
261266

262267
if ($generated === null) {

0 commit comments

Comments
 (0)