Skip to content

Commit 1569b50

Browse files
Merge branch '5.4' into 6.0
* 5.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents b62cd5e + 7d0d012 commit 1569b50

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
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 {

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

0 commit comments

Comments
 (0)