File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed
src/Symfony/Component/OptionsResolver Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -86,13 +86,11 @@ public function resolve(array $options = array())
86
86
}
87
87
88
88
/**
89
- * @param string $option
90
- * @param \Closure $normalizer
91
- *
92
- * @return NestedOptions
89
+ * {@inheritdoc}
93
90
*/
94
- public function setNormalizer ( $ option , \Closure $ normalizer )
91
+ protected function normalize ( \Closure $ normalizer, $ value )
95
92
{
96
- return parent ::setNormalizer ($ option , $ normalizer ); // TODO: Change the autogenerated stub
93
+ // Pass the resolved parent options as third argument.
94
+ return $ normalizer ($ this , $ value , $ this ->root );
97
95
}
98
96
}
Original file line number Diff line number Diff line change @@ -1319,7 +1319,7 @@ public function offsetGet($option)
1319
1319
// BEGIN
1320
1320
$ this ->calling [$ option ] = true ;
1321
1321
try {
1322
- $ value = $ normalizer ( $ this , $ value );
1322
+ $ value = $ this -> normalize ( $ normalizer , $ value );
1323
1323
} finally {
1324
1324
unset($ this ->calling [$ option ]);
1325
1325
}
@@ -1400,6 +1400,21 @@ public function __clone()
1400
1400
}
1401
1401
}
1402
1402
1403
+ /**
1404
+ * Executes the normalizer on the validated option value.
1405
+ *
1406
+ * Extract this bit of logic in order to override it in NestedOptions.
1407
+ *
1408
+ * @param \Closure $normalizer The option normalizer
1409
+ * @param mixed $value The validated option value to normalize
1410
+ *
1411
+ * @return mixed The normalized option value
1412
+ */
1413
+ protected function normalize (\Closure $ normalizer , $ value )
1414
+ {
1415
+ return $ normalizer ($ this , $ value );
1416
+ }
1417
+
1403
1418
/**
1404
1419
* Returns a string representation of the type of the value.
1405
1420
*
You can’t perform that action at this time.
0 commit comments