Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb51cce4

Browse files
committed
nested normalizer get passed parent options
1 parentccd5ce1 commitb51cce4

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

‎src/Symfony/Component/OptionsResolver/NestedOptions.php‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,11 @@ public function resolve(array $options = array())
8686
}
8787

8888
/**
89-
* @param string $option
90-
* @param \Closure $normalizer
91-
*
92-
* @return NestedOptions
89+
* {@inheritdoc}
9390
*/
94-
publicfunctionsetNormalizer($option,\Closure$normalizer)
91+
protectedfunctionnormalize(\Closure$normalizer,$value)
9592
{
96-
returnparent::setNormalizer($option,$normalizer);// TODO: Change the autogenerated stub
93+
// Pass the resolved parent options as third argument.
94+
return$normalizer($this,$value,$this->root);
9795
}
9896
}

‎src/Symfony/Component/OptionsResolver/OptionsResolver.php‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ public function offsetGet($option)
13191319
// BEGIN
13201320
$this->calling[$option] =true;
13211321
try {
1322-
$value =$normalizer($this,$value);
1322+
$value =$this->normalize($normalizer,$value);
13231323
}finally {
13241324
unset($this->calling[$option]);
13251325
}
@@ -1400,6 +1400,21 @@ public function __clone()
14001400
}
14011401
}
14021402

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+
protectedfunctionnormalize(\Closure$normalizer,$value)
1414+
{
1415+
return$normalizer($this,$value);
1416+
}
1417+
14031418
/**
14041419
* Returns a string representation of the type of the value.
14051420
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp