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