Skip to content

Commit 4d10ee0

Browse files
Merge branch '4.4'
* 4.4: Improve some URLs cleanup remaining param and internal Intl FulLTransformer [HttpClient] fix data loss when streaming as a PHP resource Fix test compatibility with 4.x components [Cache] cs fix
2 parents cb7b25a + 4ce8f19 commit 4d10ee0

File tree

10 files changed

+78
-117
lines changed

10 files changed

+78
-117
lines changed

Collator/Collator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function asort(&$array, $sortFlag = self::SORT_REGULAR)
130130
* 0 if $str1 is equal than $str2
131131
* -1 if $str1 is less than $str2
132132
*
133-
* @see http://www.php.net/manual/en/collator.compare.php
133+
* @see https://php.net/collator.compare
134134
*
135135
* @throws MethodNotImplementedException
136136
*/
@@ -146,7 +146,7 @@ public function compare($str1, $str2)
146146
*
147147
* @return bool|int The attribute value on success or false on error
148148
*
149-
* @see http://www.php.net/manual/en/collator.getattribute.php
149+
* @see https://php.net/collator.getattribute
150150
*
151151
* @throws MethodNotImplementedException
152152
*/
@@ -195,7 +195,7 @@ public function getLocale($type = Locale::ACTUAL_LOCALE)
195195
*
196196
* @return string The collation key for $string
197197
*
198-
* @see http://www.php.net/manual/en/collator.getsortkey.php
198+
* @see https://php.net/collator.getsortkey
199199
*
200200
* @throws MethodNotImplementedException
201201
*/
@@ -209,7 +209,7 @@ public function getSortKey($string)
209209
*
210210
* @return bool|int The current collator's strength or false on failure
211211
*
212-
* @see http://www.php.net/manual/en/collator.getstrength.php
212+
* @see https://php.net/collator.getstrength
213213
*
214214
* @throws MethodNotImplementedException
215215
*/
@@ -226,7 +226,7 @@ public function getStrength()
226226
*
227227
* @return bool True on success or false on failure
228228
*
229-
* @see http://www.php.net/manual/en/collator.setattribute.php
229+
* @see https://php.net/collator.setattribute
230230
*
231231
* @throws MethodNotImplementedException
232232
*/
@@ -248,7 +248,7 @@ public function setAttribute($attr, $val)
248248
*
249249
* @return bool True on success or false on failure
250250
*
251-
* @see http://www.php.net/manual/en/collator.setstrength.php
251+
* @see https://php.net/collator.setstrength
252252
*
253253
* @throws MethodNotImplementedException
254254
*/
@@ -264,7 +264,7 @@ public function setStrength($strength)
264264
*
265265
* @return bool True on success or false on failure
266266
*
267-
* @see http://www.php.net/manual/en/collator.sortwithsortkeys.php
267+
* @see https://php.net/collator.sortwithsortkeys
268268
*
269269
* @throws MethodNotImplementedException
270270
*/
@@ -284,7 +284,7 @@ public function sortWithSortKeys(&$arr)
284284
*
285285
* @return bool True on success or false on failure
286286
*
287-
* @see http://www.php.net/manual/en/collator.sort.php
287+
* @see https://php.net/collator.sort
288288
*
289289
* @throws MethodNotImplementedException
290290
*/

Data/Generator/LanguageDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class LanguageDataGenerator extends AbstractDataGenerator
2828
{
2929
/**
30-
* Source: http://www-01.sil.org/iso639-3/codes.asp.
30+
* Source: https://iso639-3.sil.org/code_tables/639/data
3131
*/
3232
private static $preferredAlpha2ToAlpha3Mapping = [
3333
'ak' => 'aka',

Data/Util/ArrayAccessibleResourceBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Work-around for a bug in PHP's \ResourceBundle implementation.
1818
*
19-
* More information can be found on https://bugs.php.net/bug.php?id=64356.
19+
* More information can be found on https://bugs.php.net/64356.
2020
* This class can be removed once that bug is fixed.
2121
*
2222
* @author Bernhard Schussek <[email protected]>

DateFormatter/DateFormat/FullTransformer.php

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,9 @@ public function __construct(string $pattern, string $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
*
85-
* @param \DateTime $dateTime A DateTime object to be used to generate the formatted value
86-
*
8775
* @return string The formatted value
8876
*/
8977
public function format(\DateTime $dateTime)
@@ -98,14 +86,9 @@ public function format(\DateTime $dateTime)
9886
/**
9987
* Return the formatted ICU value for the matched date characters.
10088
*
101-
* @param string $dateChars The date characters to be replaced with a formatted ICU value
102-
* @param \DateTime $dateTime A DateTime object to be used to generate the formatted value
103-
*
104-
* @return string The formatted value
105-
*
10689
* @throws NotImplementedException When it encounters a not implemented date character
10790
*/
108-
public function formatReplace($dateChars, $dateTime)
91+
private function formatReplace(string $dateChars, \DateTime $dateTime): string
10992
{
11093
$length = \strlen($dateChars);
11194

@@ -167,12 +150,10 @@ public function parse(\DateTime $dateTime, $value)
167150
/**
168151
* Retrieve a regular expression to match with a formatted value.
169152
*
170-
* @param string $pattern The pattern to create the reverse matching regular expression
171-
*
172153
* @return string The reverse matching regular expression with named captures being formed by the
173154
* transformer index in the $transformer array
174155
*/
175-
public function getReverseMatchingRegExp($pattern)
156+
private function getReverseMatchingRegExp(string $pattern): string
176157
{
177158
$escapedPattern = preg_quote($pattern, '/');
178159

@@ -189,9 +170,8 @@ public function getReverseMatchingRegExp($pattern)
189170
return $this->replaceQuoteMatch($dateChars);
190171
}
191172

192-
$transformers = $this->getTransformers();
193-
if (isset($transformers[$transformerIndex])) {
194-
$transformer = $transformers[$transformerIndex];
173+
if (isset($this->transformers[$transformerIndex])) {
174+
$transformer = $this->transformers[$transformerIndex];
195175
$captureName = str_repeat($transformerIndex, $length);
196176

197177
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
@@ -203,24 +183,16 @@ public function getReverseMatchingRegExp($pattern)
203183

204184
/**
205185
* Check if the first char of a string is a single quote.
206-
*
207-
* @param string $quoteMatch The string to check
208-
*
209-
* @return bool true if matches, false otherwise
210186
*/
211-
public function isQuoteMatch($quoteMatch)
187+
private function isQuoteMatch(string $quoteMatch): bool
212188
{
213189
return "'" === $quoteMatch[0];
214190
}
215191

216192
/**
217193
* Replaces single quotes at the start or end of a string with two single quotes.
218-
*
219-
* @param string $quoteMatch The string to replace the quotes
220-
*
221-
* @return string A string with the single quotes replaced
222194
*/
223-
public function replaceQuoteMatch($quoteMatch)
195+
private function replaceQuoteMatch(string $quoteMatch): string
224196
{
225197
if (preg_match("/^'+$/", $quoteMatch)) {
226198
return str_replace("''", "'", $quoteMatch);
@@ -231,12 +203,8 @@ public function replaceQuoteMatch($quoteMatch)
231203

232204
/**
233205
* Builds a chars match regular expression.
234-
*
235-
* @param string $specialChars A string of chars to build the regular expression
236-
*
237-
* @return string The chars match regular expression
238206
*/
239-
protected function buildCharsMatch($specialChars)
207+
private function buildCharsMatch(string $specialChars): string
240208
{
241209
$specialCharsArray = str_split($specialChars);
242210

@@ -250,10 +218,8 @@ protected function buildCharsMatch($specialChars)
250218
/**
251219
* Normalize a preg_replace match array, removing the numeric keys and returning an associative array
252220
* with the value and pattern values for the matched Transformer.
253-
*
254-
* @return array
255221
*/
256-
protected function normalizeArray(array $data)
222+
private function normalizeArray(array $data): array
257223
{
258224
$ret = [];
259225

@@ -275,12 +241,9 @@ protected function normalizeArray(array $data)
275241
* Calculates the Unix timestamp based on the matched values by the reverse matching regular
276242
* expression of parse().
277243
*
278-
* @param \DateTime $dateTime The DateTime object to be used to calculate the timestamp
279-
* @param array $options An array with the matched values to be used to calculate the timestamp
280-
*
281244
* @return bool|int The calculated timestamp or false if matched date is invalid
282245
*/
283-
protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
246+
private function calculateUnixTimestamp(\DateTime $dateTime, array $options)
284247
{
285248
$options = $this->getDefaultValueForOptions($options);
286249

DateFormatter/DateFormat/TimezoneTransformer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ public function extractDateOptions(string $matched, int $length): array
9292
*
9393
* @return string A timezone identifier
9494
*
95-
* @see http://php.net/manual/en/timezones.others.php
96-
* @see http://www.twinsun.com/tz/tz-link.htm
95+
* @see https://php.net/timezones.others
9796
*
9897
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
9998
* @throws \InvalidArgumentException When the value can not be matched with pattern

DateFormatter/DateFormat/Transformer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ abstract class Transformer
2323
/**
2424
* Format a value using a configured DateTime as date/time source.
2525
*
26-
*
2726
* @param \DateTime $dateTime A DateTime object to be used to generate the formatted value
2827
* @param int $length The formatted value string length
2928
*

0 commit comments

Comments
 (0)