Skip to content

Commit db4f3b0

Browse files
committed
Improve preprocessor
1 parent cfe2996 commit db4f3b0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Directives/DirectivesProviderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ interface DirectivesProviderInterface
2020

2121
/**
2222
* @param string $directive
23-
* @param string|callable $value
23+
* @param mixed $value
2424
*/
25-
public function define(string $directive, $value = self::DEFAULT_VALUE): void;
25+
public function define(string $directive, mixed $value = self::DEFAULT_VALUE): void;
2626

2727
/**
2828
* @param string $directive

src/Directives/RepositoryTrait.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ trait RepositoryTrait
3131
*/
3232
public function define(string $directive, $value = ''): void
3333
{
34-
$this->defines[$directive] = $this->cast($value);
34+
$expr = $this->cast($value);
35+
36+
if ($expr instanceof ObjectLikeDirective) {
37+
$this->defines = \array_merge([$directive => $expr], $this->defines);
38+
} else {
39+
$this->defines[$directive] = $expr;
40+
}
3541
}
3642

3743
/**

0 commit comments

Comments
 (0)