8000 [Intl] fix nullable phpdocs and useless method visibility of internal… · symfony/symfony@63b71b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 63b71b5

Browse files
committed
[Intl] fix nullable phpdocs and useless method visibility of internal class
1 parent 48859fd commit 63b71b5

File tree

4 files changed

+20
-31
lines changed

4 files changed

+20
-31
lines changed

src/Symfony/Component/Intl/Collator/Collator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Collator
7070
const SORT_STRING = 1;
7171

7272
/**
73-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
73+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
7474
*
7575
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
7676
*/
@@ -84,7 +84,7 @@ public function __construct($locale)
8484
/**
8585
* Static constructor.
8686
*
87-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
87+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
8888
*
8989
* @return self
9090
*

src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ public function __construct($pattern, $timezone)
6969
];
7070
}
7171

72-
/**
73-
* Return the array of Transformer objects.
74-
*
75-
* @return Transformer[] Associative array of Transformer objects (format char => Transformer)
76-
*/
77-
public function getTransformers()
78-
{
79-
return $this->transformers;
80-
}
81-
8272
/**
8373
* Format a DateTime using ICU dateformat pattern.
8474
*
@@ -105,7 +95,7 @@ public function format(\DateTime $dateTime)
10595
*
10696
* @throws NotImplementedException When it encounters a not implemented date character
10797
*/
108-
public function formatReplace($dateChars, $dateTime)
98+
private function formatReplace($dateChars, \DateTime $dateTime)
10999
{
110100
$length = \strlen($dateChars);
111101

@@ -172,7 +162,7 @@ public function parse(\DateTime $dateTime, $value)
172162
* @return string The reverse matching regular expression with named captures being formed by the
173163
* transformer index in the $transformer array
174164
*/
175-
public function getReverseMatchingRegExp($pattern)
165+
private function getReverseMatchingRegExp($pattern)
176166
{
177167
$escapedPattern = preg_quote($pattern, '/');
178168

@@ -189,9 +179,8 @@ public function getReverseMatchingRegExp($pattern)
189179
return $this->replaceQuoteMatch($dateChars);
190180
}
191181

192-
$transformers = $this->getTransformers();
193-
if (isset($transformers[$transformerIndex])) {
194-
$transformer = $transformers[$transformerIndex];
182+
if (isset($this->transformers[$transformerIndex])) {
183+
$transformer = $this->transformers[$transformerIndex];
195184
$captureName = str_repeat($transformerIndex, $length);
196185

197186
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
@@ -208,7 +197,7 @@ public function getReverseMatchingRegExp($pattern)
208197
*
209198
* @return bool true if matches, false otherwise
210199
*/
211-
public function isQuoteMatch($quoteMatch)
200+
private function isQuoteMatch($quoteMatch)
212201
{
213202
return "'" === $quoteMatch[0];
214203
}
@@ -220,7 +209,7 @@ public function isQuoteMatch($quoteMatch)
220209
*
221210
* @return string A string with the single quotes replaced
222211
*/
223-
public function replaceQuoteMatch($quoteMatch)
212+
private function replaceQuoteMatch($quoteMatch)
224213
{
225214
if (preg_match("/^'+$/", $quoteMatch)) {
226215
return str_replace("''", "'", $quoteMatch);
@@ -236,7 +225,7 @@ public function replaceQuoteMatch($quoteMatch)
236225
*
237226
* @return string The chars match regular expression
238227
*/
239-
protected function buildCharsMatch($specialChars)
228+
private function buildCharsMatch($specialChars)
240229
{
241230
$specialCharsArray = str_split($specialChars);
242231

@@ -253,7 +242,7 @@ protected function buildCharsMatch($specialChars)
253242
*
254243
* @return array
255244
*/
256-
protected function normalizeArray(array $data)
245+
private function normalizeArray(array $data)
257246
{
258247
$ret = [];
259248

@@ -280,7 +269,7 @@ protected function normalizeArray(array $data)
280269
*
281270
* @return bool|int The calculated timestamp or false if matched date is invalid
282271
*/
283-
protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
272+
private function calculateUnixTimestamp(\DateTime $dateTime, array $options)
284273
{
285274
$options = $this->getDefaultValueForOptions($options);
286275

src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class IntlDateFormatter
118118
private $timeZoneId;
119119

120120
/**
121-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
121+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
122122
* @param int|null $datetype Type of date formatting, one of the format type constants
123123
* @param int|null $timetype Type of time formatting, one of the format type constants
124124
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
@@ -152,7 +152,7 @@ public function __construct($locale, $datetype, $timetype, $timezone = null, $ca
152152
/**
153153
* Static constructor.
154154
*
155-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
155+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
156156
* @param int|null $datetype Type of date formatting, one of the format type constants
157157
* @param int|null $timetype Type of time formatting, one of the format type constants
158158
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ class NumberFormatter
241241
];
242242

243243
/**
244-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245-
* @param int $style Style of the formatting, one of the format style constants.
246-
* The only supported styles are NumberFormatter::DECIMAL
247-
* and NumberFormatter::CURRENCY.
248-
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249-
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250-
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
244+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245+
* @param int $style Style of the formatting, one of the format style constants.
246+
* The only supported styles are NumberFormatter::DECIMAL
247+
* and NumberFormatter::CURRENCY.
248+
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249+
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250+
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
251251
*
252252
* @see http://www.php.net/manual/en/numberformatter.create.php
253253
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details

0 commit comments

Comments
 (0)
0