@@ -23,16 +23,13 @@ final class FilterFactory
2323 /**
2424 * Returns a normalize filter for labels, names ...
2525 *
26- * @param callable ...$callables Attached to the end of the filter chain
26+ * @param callable ...$callables Attached to the end of the filter chain
2727 * @return callable
2828 */
2929 public static function normalizeFilter (callable ...$ callables ): callable
3030 {
3131 $ filter = new Filter \FilterChain ();
3232 $ filter ->attach (new NormalizeLabel ());
33- $ filter ->attach (new Filter \Word \SeparatorToSeparator (' ' , '- ' ));
34- $ filter ->attach (new Filter \Word \UnderscoreToCamelCase ());
35- $ filter ->attach (new Filter \Word \DashToCamelCase ());
3633
3734 foreach ($ callables as $ callable ) {
3835 $ filter ->attach ($ callable );
@@ -48,7 +45,15 @@ public static function normalizeFilter(callable ...$callables): callable
4845 */
4946 public static function classNameFilter (): callable
5047 {
51- return new UpperCaseFirst (self ::normalizeFilter ());
48+ return new UpperCaseFirst (
49+ self ::normalizeFilter (
50+ new Filter \Word \CamelCaseToUnderscore (),
51+ new Filter \StringToLower (),
52+ new Filter \Word \UnderscoreToCamelCase (),
53+ new Filter \Word \SeparatorToSeparator (' ' , '- ' ),
54+ new Filter \Word \DashToCamelCase ()
55+ )
56+ );
5257 }
5358
5459 /**
@@ -59,6 +64,8 @@ public static function classNameFilter(): callable
5964 public static function constantNameFilter (): callable
6065 {
6166 return self ::normalizeFilter (
67+ new Filter \Word \SeparatorToSeparator (' ' , '- ' ),
68+ new Filter \Word \DashToCamelCase (),
6269 new Filter \Word \CamelCaseToUnderscore (),
6370 new Filter \StringToUpper ()
6471 );
@@ -72,6 +79,8 @@ public static function constantNameFilter(): callable
7279 public static function constantValueFilter (): callable
7380 {
7481 return self ::normalizeFilter (
82+ new Filter \Word \SeparatorToSeparator (' ' , '- ' ),
83+ new Filter \Word \DashToCamelCase (),
7584 new Filter \Word \CamelCaseToUnderscore (),
7685 new Filter \StringToLower ()
7786 );
@@ -84,7 +93,15 @@ public static function constantValueFilter(): callable
8493 */
8594 public static function propertyNameFilter (): callable
8695 {
87- return new LowerCaseFirst (self ::normalizeFilter ());
96+ return new LowerCaseFirst (
97+ self ::normalizeFilter (
98+ new Filter \Word \CamelCaseToUnderscore (),
99+ new Filter \StringToLower (),
100+ new Filter \Word \UnderscoreToCamelCase (),
101+ new Filter \Word \SeparatorToSeparator (' ' , '- ' ),
102+ new Filter \Word \DashToCamelCase ()
103+ )
104+ );
88105 }
89106
90107 /**
@@ -94,7 +111,16 @@ public static function propertyNameFilter(): callable
94111 */
95112 public static function methodNameFilter (): callable
96113 {
97- return new LowerCaseFirst (self ::normalizeFilter (new UpperToLower ()));
114+ return new LowerCaseFirst (
115+ self ::normalizeFilter (
116+ new Filter \Word \CamelCaseToUnderscore (),
117+ new Filter \StringToLower (),
118+ new Filter \Word \UnderscoreToCamelCase (),
119+ new Filter \Word \SeparatorToSeparator (' ' , '- ' ),
120+ new Filter \Word \DashToCamelCase (),
121+ new UpperToLower ()
122+ )
123+ );
98124 }
99125
100126 /**
0 commit comments