19
19
*/
20
20
class UndefinedCallableHandler
21
21
{
22
- private static $ filterComponents = [
22
+ private const FILTER_COMPONENTS = [
23
23
'humanize ' => 'form ' ,
24
24
'trans ' => 'translation ' ,
25
25
'transchoice ' => 'translation ' ,
26
26
'yaml_encode ' => 'yaml ' ,
27
27
'yaml_dump ' => 'yaml ' ,
28
28
];
29
29
30
- private static $ functionComponents = [
30
+ private const FUNCTION_COMPONENTS = [
31
31
'asset ' => 'asset ' ,
32
32
'asset_version ' => 'asset ' ,
33
33
'dump ' => 'debug-bundle ' ,
@@ -57,7 +57,7 @@ class UndefinedCallableHandler
57
57
'workflow_marked_places ' => 'workflow ' ,
58
58
];
59
59
60
- private static $ fullStackEnable = [
60
+ private const FULL_STACK_ENABLE = [
61
61
'form ' => 'enable "framework.form" ' ,
62
62
'security-core ' => 'add the "SecurityBundle" ' ,
63
63
'security-http ' => 'add the "SecurityBundle" ' ,
@@ -67,30 +67,30 @@ class UndefinedCallableHandler
67
67
68
68
public static function onUndefinedFilter (string $ name ): bool
69
69
{
70
- if (!isset (self ::$ filterComponents [$ name ])) {
70
+ if (!isset (self ::FILTER_COMPONENTS [$ name ])) {
71
71
return false ;
72
72
}
73
73
74
- self ::onUndefined ($ name , 'filter ' , self ::$ filterComponents [$ name ]);
74
+ self ::onUndefined ($ name , 'filter ' , self ::FILTER_COMPONENTS [$ name ]);
75
75
76
76
return true ;
77
77
}
78
78
79
79
public static function onUndefinedFunction (string $ name ): bool
80
80
{
81
- if (!isset (self ::$ functionComponents [$ name ])) {
81
+ if (!isset (self ::FUNCTION_COMPONENTS [$ name ])) {
82
82
return false ;
83
83
}
84
84
85
- self ::onUndefined ($ name , 'function ' , self ::$ functionComponents [$ name ]);
85
+ self ::onUndefined ($ name , 'function ' , self ::FUNCTION_COMPONENTS [$ name ]);
86
86
87
87
return true ;
88
88
}
89
89
90
90
private static function onUndefined (string $ name , string $ type , string $ component )
91
91
{
92
- if (class_exists (FullStack::class) && isset (self ::$ fullStackEnable [$ component ])) {
93
- throw new SyntaxError (sprintf ('Did you forget to %s? Unknown %s "%s". ' , self ::$ fullStackEnable [$ component ], $ type , $ name ));
92
+ if (class_exists (FullStack::class) && isset (self ::FULL_STACK_ENABLE [$ component ])) {
93
+ throw new SyntaxError (sprintf ('Did you forget to %s? Unknown %s "%s". ' , self ::FULL_STACK_ENABLE [$ component ], $ type , $ name ));
94
94
}
95
95
96
96
throw new SyntaxError (sprintf ('Did you forget to run "composer require symfony/%s"? Unknown %s "%s". ' , $ component , $ type , $ name ));
0 commit comments