File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 26
26
"latte/latte" : " ^2.4.1" ,
27
27
"tracy/tracy" : " ^2.4"
28
28
},
29
+ "conflict" : {
30
+ "nette/di" : " <3.0-stable"
31
+ },
29
32
"autoload" : {
30
33
"classmap" : [" src/" ]
31
34
},
Original file line number Diff line number Diff line change 17
17
*/
18
18
class FormsExtension extends Nette \DI \CompilerExtension
19
19
{
20
- private $ defaults = [
21
- 'messages ' => [],
22
- ];
20
+ public function __construct ()
21
+ {
22
+ $ this ->config = new class {
23
+ /** @var string[] */
24
+ public $ messages = [];
25
+ };
26
+ }
23
27
24
28
25
29
public function afterCompile (Nette \PhpGenerator \ClassType $ class )
26
30
{
27
31
$ initialize = $ class ->getMethod ('initialize ' );
28
- $ config = $ this ->validateConfig ($ this ->defaults );
29
32
30
- foreach (( array ) $ config[ ' messages ' ] as $ name => $ text ) {
33
+ foreach ($ this -> config -> messages as $ name => $ text ) {
31
34
if (defined ('Nette\Forms\Form:: ' . $ name )) {
32
35
$ initialize ->addBody ('Nette\Forms\Validator::$messages[Nette\Forms\Form::?] = ?; ' , [$ name , $ text ]);
33
36
} elseif (defined ($ name )) {
You can’t perform that action at this time.
0 commit comments