[Intl] fix nullable phpdocs and useless method visibility of internal class

This commit is contained in:
Tobias Schultze 2019-08-07 18:29:13 +02:00
parent 48859fd125
commit 63b71b5ade
4 changed files with 20 additions and 31 deletions

View File

@ -70,7 +70,7 @@ class Collator
const SORT_STRING = 1;
/**
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
*
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
*/
@ -84,7 +84,7 @@ class Collator
/**
* Static constructor.
*
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
*
* @return self
*

View File

@ -69,16 +69,6 @@ class FullTransformer
];
}
/**
* Return the array of Transformer objects.
*
* @return Transformer[] Associative array of Transformer objects (format char => Transformer)
*/
public function getTransformers()
{
return $this->transformers;
}
/**
* Format a DateTime using ICU dateformat pattern.
*
@ -105,7 +95,7 @@ class FullTransformer
*
* @throws NotImplementedException When it encounters a not implemented date character
*/
public function formatReplace($dateChars, $dateTime)
private function formatReplace($dateChars, \DateTime $dateTime)
{
$length = \strlen($dateChars);
@ -172,7 +162,7 @@ class FullTransformer
* @return string The reverse matching regular expression with named captures being formed by the
* transformer index in the $transformer array
*/
public function getReverseMatchingRegExp($pattern)
private function getReverseMatchingRegExp($pattern)
{
$escapedPattern = preg_quote($pattern, '/');
@ -189,9 +179,8 @@ class FullTransformer
return $this->replaceQuoteMatch($dateChars);
}
$transformers = $this->getTransformers();
if (isset($transformers[$transformerIndex])) {
$transformer = $transformers[$transformerIndex];
if (isset($this->transformers[$transformerIndex])) {
$transformer = $this->transformers[$transformerIndex];
$captureName = str_repeat($transformerIndex, $length);
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
@ -208,7 +197,7 @@ class FullTransformer
*
* @return bool true if matches, false otherwise
*/
public function isQuoteMatch($quoteMatch)
private function isQuoteMatch($quoteMatch)
{
return "'" === $quoteMatch[0];
}
@ -220,7 +209,7 @@ class FullTransformer
*
* @return string A string with the single quotes replaced
*/
public function replaceQuoteMatch($quoteMatch)
private function replaceQuoteMatch($quoteMatch)
{
if (preg_match("/^'+$/", $quoteMatch)) {
return str_replace("''", "'", $quoteMatch);
@ -236,7 +225,7 @@ class FullTransformer
*
* @return string The chars match regular expression
*/
protected function buildCharsMatch($specialChars)
private function buildCharsMatch($specialChars)
{
$specialCharsArray = str_split($specialChars);
@ -253,7 +242,7 @@ class FullTransformer
*
* @return array
*/
protected function normalizeArray(array $data)
private function normalizeArray(array $data)
{
$ret = [];
@ -280,7 +269,7 @@ class FullTransformer
*
* @return bool|int The calculated timestamp or false if matched date is invalid
*/
protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
private function calculateUnixTimestamp(\DateTime $dateTime, array $options)
{
$options = $this->getDefaultValueForOptions($options);

View File

@ -118,7 +118,7 @@ class IntlDateFormatter
private $timeZoneId;
/**
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param int|null $datetype Type of date formatting, one of the format type constants
* @param int|null $timetype Type of time formatting, one of the format type constants
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
@ -152,7 +152,7 @@ class IntlDateFormatter
/**
* Static constructor.
*
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param int|null $datetype Type of date formatting, one of the format type constants
* @param int|null $timetype Type of time formatting, one of the format type constants
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier

View File

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