Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Intl/Collator/Collator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -84,7 +84,7 @@ public function __construct($locale)
/**
* 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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ public function __construct($pattern, $timezone)
];
}

/**
* Return the array of Transformer objects.
*
* @return Transformer[] Associative array of Transformer objects (format char => Transformer)
*/
public function getTransformers()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an internal class

Copy link
Member

@nicolas-grekas nicolas-grekas Aug 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change this class on 4.4
I get it's internal, but let's keep 3.4 super-stable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change reverted while merging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
return $this->transformers;
}

/**
* Format a DateTime using ICU dateformat pattern.
*
Expand All @@ -105,7 +95,7 @@ public function format(\DateTime $dateTime)
*
* @throws NotImplementedException When it encounters a not implemented date character
*/
public function formatReplace($dateChars, $dateTime)
private function formatReplace($dateChars, \DateTime $dateTime)
{
$length = \strlen($dateChars);

Expand Down Expand Up @@ -172,7 +162,7 @@ public function parse(\DateTime $dateTime, $value)
* @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, '/');

Expand All @@ -189,9 +179,8 @@ public function getReverseMatchingRegExp($pattern)
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).')';
Expand All @@ -208,7 +197,7 @@ public function getReverseMatchingRegExp($pattern)
*
* @return bool true if matches, false otherwise
*/
public function isQuoteMatch($quoteMatch)
private function isQuoteMatch($quoteMatch)
{
return "'" === $quoteMatch[0];
}
Expand All @@ -220,7 +209,7 @@ public function isQuoteMatch($quoteMatch)
*
* @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);
Expand All @@ -236,7 +225,7 @@ public function replaceQuoteMatch($quoteMatch)
*
* @return string The chars match regular expression
*/
protected function buildCharsMatch($specialChars)
private function buildCharsMatch($specialChars)
{
$specialCharsArray = str_split($specialChars);

Expand All @@ -253,7 +242,7 @@ protected function buildCharsMatch($specialChars)
*
* @return array
*/
protected function normalizeArray(array $data)
private function normalizeArray(array $data)
{
$ret = [];

Expand All @@ -280,7 +269,7 @@ protected function normalizeArray(array $data)
*
* @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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -152,7 +152,7 @@ public function __construct($locale, $datetype, $timetype, $timezone = null, $ca
/**
* 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
Expand Down
14 changes: 7 additions & 7 deletions src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down