Skip to content

Commit 7d0d012

Browse files
Merge branch '5.3' into 5.4
* 5.3: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 4c9de7b + f63212a commit 7d0d012

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

Data/Bundle/Writer/TextBundleWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private function writeTable($file, iterable $value, int $indentation, bool $fall
194194
fwrite($file, str_repeat(' ', $indentation + 1));
195195

196196
// escape colons, otherwise they are interpreted as resource types
197-
if (false !== strpos($key, ':') || false !== strpos($key, ' ')) {
197+
if (str_contains($key, ':') || str_contains($key, ' ')) {
198198
$key = '"'.$key.'"';
199199
}
200200

Data/Generator/LanguageDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
135135
$names = [];
136136
$localizedNames = [];
137137
foreach (self::generateLanguageNames($localeBundle) as $language => $name) {
138-
if (false === strpos($language, '_')) {
138+
if (!str_contains($language, '_')) {
139139
$this->languageCodes[] = $language;
140140
$names[$language] = $name;
141141
} else {

DateFormatter/DateFormat/FullTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function formatReplace(string $dateChars, \DateTime $dateTime): string
105105
}
106106

107107
// handle unimplemented characters
108-
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
108+
if (str_contains($this->notImplementedChars, $dateChars[0])) {
109109
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s".', $dateChars[0], $this->pattern));
110110
}
111111

DateFormatter/IntlDateFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ public function setTimeZoneId(?string $timeZoneId)
531531
$timeZone = $timeZoneId;
532532

533533
// Get an Etc/GMT time zone that is accepted for \DateTimeZone
534-
if ('GMT' !== $timeZoneId && 0 === strpos($timeZoneId, 'GMT')) {
534+
if ('GMT' !== $timeZoneId && str_starts_with($timeZoneId, 'GMT')) {
535535
try {
536536
$timeZoneId = DateFormat\TimezoneTransformer::getEtcTimeZoneId($timeZoneId);
537537
} catch (\InvalidArgumentException $e) {

NumberFormatter/NumberFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ public function parse(string $value, int $type = self::TYPE_DOUBLE, int &$positi
533533
// value is not valid if grouping is used, but digits are not grouped in groups of three
534534
if ($error = isset($matches['grouping']) && !preg_match('/^-?(?:\d{1,3}+)?(?:(?:,\d{3})++|\d*+)(?:\.\d*+)?$/', $value)) {
535535
// the position on error is 0 for positive and 1 for negative numbers
536-
$position = 0 === strpos($value, '-') ? 1 : 0;
536+
$position = str_starts_with($value, '-') ? 1 : 0;
537537
}
538538
} else {
539539
$error = true;

Tests/ResourceBundleTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ protected function getRootLocales()
778778
if (null === self::$rootLocales) {
779779
self::$rootLocales = array_filter($this->getLocales(), function ($locale) {
780780
// no locales for which fallback is possible (e.g "en_GB")
781-
return false === strpos($locale, '_');
781+
return !str_contains($locale, '_');
782782
});
783783
}
784784

Tests/Util/GitRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ public function testItClonesTheRepository()
5858
$this->assertNotEmpty($git->getLastAuthor());
5959
$this->assertInstanceOf(\DateTime::class, $git->getLastAuthoredDate());
6060
$this->assertStringMatchesFormat('v%s', $git->getLastTag());
61-
$this->assertStringMatchesFormat('v3%s', $git->getLastTag(function ($tag) { return 0 === strpos($tag, 'v3'); }));
61+
$this->assertStringMatchesFormat('v3%s', $git->getLastTag(function ($tag) { return str_starts_with($tag, 'v3'); }));
6262
}
6363

6464
public function testItCheckoutsToTheLastTag()
6565
{
6666
$git = GitRepository::download(self::REPO_URL, $this->targetDir);
6767
$lastCommitHash = $git->getLastCommitHash();
68-
$lastV3Tag = $git->getLastTag(function ($tag) { return 0 === strpos($tag, 'v3'); });
68+
$lastV3Tag = $git->getLastTag(function ($tag) { return str_starts_with($tag, 'v3'); });
6969

7070
$git->checkout($lastV3Tag);
7171

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"require": {
2727
"php": ">=7.2.5",
2828
"symfony/deprecation-contracts": "^2.1",
29-
"symfony/polyfill-php80": "^1.15"
29+
"symfony/polyfill-php80": "^1.16"
3030
},
3131
"require-dev": {
3232
"symfony/filesystem": "^4.4|^5.0|^6.0"

0 commit comments

Comments
 (0)