Skip to content

Commit b5cc441

Browse files
committedNov 22, 2024
Merge branch '5.4.x'
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2 parents 12b0d88 + 871bf9e commit b5cc441

16 files changed

+117
-323
lines changed
 

‎.github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
continue-on-error: ${{ matrix.experimental }}
1212
strategy:
1313
matrix:
14-
php-version: ['8.2', '8.3']
14+
php-version: ['8.2', '8.3', '8.4']
1515
extensions: [':apcu, mbstring', 'apcu, mbstring']
1616
os: [ubuntu-latest]
1717
experimental: [false]
1818
composer-options: ['']
1919
include:
20-
- { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' }
21-
- { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' }
20+
- { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' }
21+
- { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' }
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@v4
@@ -40,7 +40,7 @@ jobs:
4040
dependency-versions: highest
4141
composer-options: ${{ matrix.composer-options }}
4242

43-
- name: Run php tests
43+
- name: Run PHP tests
4444
run: composer run phpunit -- --display-deprecations --display-notices --display-warnings --display-errors --display-skipped
4545

4646
- name: Send coverage

‎CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
## [Unreleased]
44

5-
* Drop support for PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0 and PHP 8.1.
5+
* Drop support for PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0 and PHP 8.1.
6+
7+
## [Unreleased]
8+
9+
* Bump PHP minimum version to 7.2
10+
* Add support for Symfony 7
611

712
## [5.3.1] - 2023-08-23
813

‎composer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232
},
3333
"require-dev": {
3434
"phpmyadmin/coding-standard": "^4.0",
35-
"phpstan/extension-installer": "^1.3",
36-
"phpstan/phpstan": "^1.10",
37-
"phpstan/phpstan-phpunit": "^1.3",
38-
"phpstan/phpstan-strict-rules": "^1.5",
39-
"phpunit/phpunit": "^10.3",
35+
"phpstan/extension-installer": "^1.4",
36+
"phpstan/phpstan": "^1.12",
37+
"phpstan/phpstan-deprecation-rules": "^1.2",
38+
"phpstan/phpstan-phpunit": "^1.4",
39+
"phpstan/phpstan-strict-rules": "^1.6",
40+
"phpunit/phpunit": "^10.5",
4041
"psalm/plugin-phpunit": "^0.18.4",
4142
"vimeo/psalm": "^5.6"
4243
},

‎phpstan-baseline.neon

+10-100
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ parameters:
2525
count: 1
2626
path: src/Loader.php
2727

28+
-
29+
message: "#^Offset 'lang' on array\\{0\\: string, lang\\: non\\-falsy\\-string, 1\\: non\\-falsy\\-string, country\\?\\: string, 2\\?\\: string, charset\\?\\: string, 3\\?\\: string, modifier\\?\\: non\\-empty\\-string, \\.\\.\\.\\} on left side of \\?\\? always exists and is not nullable\\.$#"
30+
count: 1
31+
path: src/Loader.php
32+
33+
-
34+
message: "#^Strict comparison using \\!\\=\\= between non\\-falsy\\-string and '' will always evaluate to true\\.$#"
35+
count: 1
36+
path: src/Loader.php
37+
2838
-
2939
message: "#^Casting to int something that's already int\\.$#"
3040
count: 1
@@ -50,46 +60,11 @@ parameters:
5060
count: 1
5161
path: src/Translator.php
5262

53-
-
54-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\)\\.$#"
55-
count: 1
56-
path: tests/Cache/ApcuCacheFactoryTest.php
57-
58-
-
59-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\)\\.$#"
60-
count: 1
61-
path: tests/Cache/ApcuCacheFactoryTest.php
62-
63-
-
64-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
65-
count: 2
66-
path: tests/Cache/ApcuCacheFactoryTest.php
67-
6863
-
6964
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:markTestSkipped\\(\\)\\.$#"
7065
count: 1
7166
path: tests/Cache/ApcuCacheFactoryTest.php
7267

73-
-
74-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
75-
count: 2
76-
path: tests/Cache/ApcuCacheTest.php
77-
78-
-
79-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\)\\.$#"
80-
count: 4
81-
path: tests/Cache/ApcuCacheTest.php
82-
83-
-
84-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
85-
count: 11
86-
path: tests/Cache/ApcuCacheTest.php
87-
88-
-
89-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\)\\.$#"
90-
count: 1
91-
path: tests/Cache/ApcuCacheTest.php
92-
9368
-
9469
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:markTestSkipped\\(\\)\\.$#"
9570
count: 1
@@ -100,36 +75,6 @@ parameters:
10075
count: 1
10176
path: tests/Cache/ApcuDisabledTest.php
10277

103-
-
104-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
105-
count: 1
106-
path: tests/Cache/InMemoryCacheTest.php
107-
108-
-
109-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\)\\.$#"
110-
count: 1
111-
path: tests/Cache/InMemoryCacheTest.php
112-
113-
-
114-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
115-
count: 4
116-
path: tests/Cache/InMemoryCacheTest.php
117-
118-
-
119-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\)\\.$#"
120-
count: 1
121-
path: tests/Cache/InMemoryCacheTest.php
122-
123-
-
124-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
125-
count: 9
126-
path: tests/FunctionsTest.php
127-
128-
-
129-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
130-
count: 13
131-
path: tests/LoaderTest.php
132-
13378
-
13479
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:isInstanceOf\\(\\)\\.$#"
13580
count: 1
@@ -144,38 +89,3 @@ parameters:
14489
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\TestCase\\:\\:once\\(\\)\\.$#"
14590
count: 1
14691
path: tests/LoaderTest.php
147-
148-
-
149-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
150-
count: 16
151-
path: tests/MoFilesTest.php
152-
153-
-
154-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
155-
count: 3
156-
path: tests/PluralFormulaTest.php
157-
158-
-
159-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
160-
count: 3
161-
path: tests/PluralTest.php
162-
163-
-
164-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFileExists\\(\\)\\.$#"
165-
count: 2
166-
path: tests/StringReaderTest.php
167-
168-
-
169-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
170-
count: 2
171-
path: tests/StringReaderTest.php
172-
173-
-
174-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
175-
count: 6
176-
path: tests/TranslatorTest.php
177-
178-
-
179-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
180-
count: 6
181-
path: tests/TranslatorTest.php

‎phpstan.neon.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parameters:
66
- src
77
- tests
88
checkBenevolentUnionTypes: true
9+
checkDynamicProperties: true
910
checkImplicitMixed: true
1011
checkTooWideReturnTypesInProtectedAndPublicMethods: true
1112
checkUninitializedProperties: true
12-
reportUnmatchedIgnoredErrors: true

‎psalm-baseline.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505">
2+
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
33
<file src="src/Cache/ApcuCache.php">
44
<MixedAssignment>
55
<code><![CDATA[$cached]]></code>

‎tests/Cache/ApcuCacheFactoryTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testGetInstanceReturnApcuCache(): void
4141
{
4242
$factory = new ApcuCacheFactory();
4343
$instance = $factory->getInstance(new MoParser(null), 'foo', 'bar');
44-
$this->assertInstanceOf(ApcuCache::class, $instance);
44+
self::assertInstanceOf(ApcuCache::class, $instance);
4545
}
4646

4747
public function testConstructorSetsTtl(): void
@@ -57,7 +57,7 @@ public function testConstructorSetsTtl(): void
5757
sleep($ttl * 2);
5858

5959
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
60-
$this->assertFalse($success);
60+
self::assertFalse($success);
6161
}
6262

6363
public function testConstructorSetsReloadOnMiss(): void
@@ -74,7 +74,7 @@ public function testConstructorSetsReloadOnMiss(): void
7474

7575
apcu_delete('mo_' . $locale . '.' . $domain . '.' . $msgid);
7676
$actual = $instance->get($msgid);
77-
$this->assertSame($expected, $actual);
77+
self::assertSame($expected, $actual);
7878
}
7979

8080
public function testConstructorSetsPrefix(): void
@@ -91,6 +91,6 @@ public function testConstructorSetsPrefix(): void
9191
$factory->getInstance($parser, $locale, $domain);
9292

9393
$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
94-
$this->assertSame($expected, $actual);
94+
self::assertSame($expected, $actual);
9595
}
9696
}

‎tests/Cache/ApcuCacheTest.php

+18-18
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testConstructorLoadsCache(): void
5151
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
5252

5353
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid);
54-
$this->assertSame($expected, $actual);
54+
self::assertSame($expected, $actual);
5555
}
5656

5757
public function testConstructorSetsTtl(): void
@@ -65,9 +65,9 @@ public function testConstructorSetsTtl(): void
6565
sleep($ttl * 2);
6666

6767
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
68-
$this->assertFalse($success);
68+
self::assertFalse($success);
6969
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY, $success);
70-
$this->assertFalse($success);
70+
self::assertFalse($success);
7171
}
7272

7373
public function testConstructorSetsReloadOnMiss(): void
@@ -89,7 +89,7 @@ public function testConstructorSetsReloadOnMiss(): void
8989

9090
apcu_delete($prefix . $locale . '.' . $domain . '.' . $msgid);
9191
$actual = $cache->get($msgid);
92-
$this->assertEquals($expected, $actual);
92+
self::assertSame($expected, $actual);
9393
}
9494

9595
public function testConstructorSetsPrefix(): void
@@ -103,7 +103,7 @@ public function testConstructorSetsPrefix(): void
103103
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain, 0, true, $prefix);
104104

105105
$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
106-
$this->assertSame($expected, $actual);
106+
self::assertSame($expected, $actual);
107107
}
108108

109109
public function testEnsureTranslationsLoadedSetsLoadedKey(): void
@@ -115,7 +115,7 @@ public function testEnsureTranslationsLoadedSetsLoadedKey(): void
115115
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
116116

117117
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY);
118-
$this->assertSame($expected, $actual);
118+
self::assertSame($expected, $actual);
119119
}
120120

121121
public function testEnsureTranslationsLoadedHonorsLock(): void
@@ -134,9 +134,9 @@ public function testEnsureTranslationsLoadedHonorsLock(): void
134134
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
135135

136136
$actual = apcu_fetch($lock);
137-
$this->assertSame(1, $actual);
137+
self::assertSame(1, $actual);
138138
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
139-
$this->assertFalse($success);
139+
self::assertFalse($success);
140140
}
141141

142142
public function testGetReturnsMsgstr(): void
@@ -147,7 +147,7 @@ public function testGetReturnsMsgstr(): void
147147
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), 'foo', 'bar');
148148

149149
$actual = $cache->get($msgid);
150-
$this->assertSame($expected, $actual);
150+
self::assertSame($expected, $actual);
151151
}
152152

153153
public function testGetReturnsMsgidForCacheMiss(): void
@@ -157,7 +157,7 @@ public function testGetReturnsMsgidForCacheMiss(): void
157157
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
158158

159159
$actual = $cache->get($expected);
160-
$this->assertSame($expected, $actual);
160+
self::assertSame($expected, $actual);
161161
}
162162

163163
public function testStoresMsgidOnCacheMiss(): void
@@ -170,7 +170,7 @@ public function testStoresMsgidOnCacheMiss(): void
170170
$cache->get($expected);
171171

172172
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $expected);
173-
$this->assertSame($expected, $actual);
173+
self::assertSame($expected, $actual);
174174
}
175175

176176
public function testGetReloadsOnCacheMiss(): void
@@ -184,7 +184,7 @@ public function testGetReloadsOnCacheMiss(): void
184184

185185
apcu_delete('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY);
186186
$actual = $cache->get($msgid);
187-
$this->assertSame($expected, $actual);
187+
self::assertSame($expected, $actual);
188188
}
189189

190190
public function testReloadOnMissHonorsLock(): void
@@ -207,7 +207,7 @@ public function testReloadOnMissHonorsLock(): void
207207
});
208208
$actual = $method->invoke($cache, $msgid);
209209

210-
$this->assertSame($expected, $actual);
210+
self::assertSame($expected, $actual);
211211
}
212212

213213
public function testSetSetsMsgstr(): void
@@ -219,21 +219,21 @@ public function testSetSetsMsgstr(): void
219219
$cache->set($msgid, $expected);
220220

221221
$actual = $cache->get($msgid);
222-
$this->assertSame($expected, $actual);
222+
self::assertSame($expected, $actual);
223223
}
224224

225225
public function testHasReturnsFalse(): void
226226
{
227227
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
228228
$actual = $cache->has('Column');
229-
$this->assertFalse($actual);
229+
self::assertFalse($actual);
230230
}
231231

232232
public function testHasReturnsTrue(): void
233233
{
234234
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), 'foo', 'bar');
235235
$actual = $cache->has('Column');
236-
$this->assertTrue($actual);
236+
self::assertTrue($actual);
237237
}
238238

239239
public function testSetAllSetsTranslations(): void
@@ -248,7 +248,7 @@ public function testSetAllSetsTranslations(): void
248248

249249
foreach ($translations as $msgid => $expected) {
250250
$actual = $cache->get($msgid);
251-
$this->assertEquals($expected, $actual);
251+
self::assertSame($expected, $actual);
252252
}
253253
}
254254

@@ -263,6 +263,6 @@ public function testCacheStoresPluralForms(): void
263263

264264
$msgstr = $cache->get($msgid);
265265
$actual = explode(chr(0), $msgstr);
266-
$this->assertSame($expected, $actual);
266+
self::assertSame($expected, $actual);
267267
}
268268
}

0 commit comments

Comments
 (0)
Failed to load comments.