Skip to content

Commit

Permalink
Merge branch '5.4.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
  • Loading branch information
MauricioFauth committed Nov 22, 2024
2 parents 12b0d88 + 871bf9e commit b5cc441
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 323 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version: ['8.2', '8.3']
php-version: ['8.2', '8.3', '8.4']
extensions: [':apcu, mbstring', 'apcu, mbstring']
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
include:
- { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' }
- { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' }
- { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' }
- { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' }
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -40,7 +40,7 @@ jobs:
dependency-versions: highest
composer-options: ${{ matrix.composer-options }}

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

- name: Send coverage
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## [Unreleased]

* Drop support for PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0 and PHP 8.1.
* Drop support for PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0 and PHP 8.1.

## [Unreleased]

* Bump PHP minimum version to 7.2
* Add support for Symfony 7

## [5.3.1] - 2023-08-23

Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
},
"require-dev": {
"phpmyadmin/coding-standard": "^4.0",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "^10.3",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-strict-rules": "^1.6",
"phpunit/phpunit": "^10.5",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.6"
},
Expand Down
110 changes: 10 additions & 100 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ parameters:
count: 1
path: src/Loader.php

-
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\\.$#"
count: 1
path: src/Loader.php

-
message: "#^Strict comparison using \\!\\=\\= between non\\-falsy\\-string and '' will always evaluate to true\\.$#"
count: 1
path: src/Loader.php

-
message: "#^Casting to int something that's already int\\.$#"
count: 1
Expand All @@ -50,46 +60,11 @@ parameters:
count: 1
path: src/Translator.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\)\\.$#"
count: 1
path: tests/Cache/ApcuCacheFactoryTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\)\\.$#"
count: 1
path: tests/Cache/ApcuCacheFactoryTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
count: 2
path: tests/Cache/ApcuCacheFactoryTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:markTestSkipped\\(\\)\\.$#"
count: 1
path: tests/Cache/ApcuCacheFactoryTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 2
path: tests/Cache/ApcuCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\)\\.$#"
count: 4
path: tests/Cache/ApcuCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
count: 11
path: tests/Cache/ApcuCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\)\\.$#"
count: 1
path: tests/Cache/ApcuCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:markTestSkipped\\(\\)\\.$#"
count: 1
Expand All @@ -100,36 +75,6 @@ parameters:
count: 1
path: tests/Cache/ApcuDisabledTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 1
path: tests/Cache/InMemoryCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\)\\.$#"
count: 1
path: tests/Cache/InMemoryCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
count: 4
path: tests/Cache/InMemoryCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\)\\.$#"
count: 1
path: tests/Cache/InMemoryCacheTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 9
path: tests/FunctionsTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 13
path: tests/LoaderTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:isInstanceOf\\(\\)\\.$#"
count: 1
Expand All @@ -144,38 +89,3 @@ parameters:
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\TestCase\\:\\:once\\(\\)\\.$#"
count: 1
path: tests/LoaderTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 16
path: tests/MoFilesTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 3
path: tests/PluralFormulaTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
count: 3
path: tests/PluralTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFileExists\\(\\)\\.$#"
count: 2
path: tests/StringReaderTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
count: 2
path: tests/StringReaderTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEquals\\(\\)\\.$#"
count: 6
path: tests/TranslatorTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\)\\.$#"
count: 6
path: tests/TranslatorTest.php
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
- src
- tests
checkBenevolentUnionTypes: true
checkDynamicProperties: true
checkImplicitMixed: true
checkTooWideReturnTypesInProtectedAndPublicMethods: true
checkUninitializedProperties: true
reportUnmatchedIgnoredErrors: true
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505">
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
<file src="src/Cache/ApcuCache.php">
<MixedAssignment>
<code><![CDATA[$cached]]></code>
Expand Down
8 changes: 4 additions & 4 deletions tests/Cache/ApcuCacheFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testGetInstanceReturnApcuCache(): void
{
$factory = new ApcuCacheFactory();
$instance = $factory->getInstance(new MoParser(null), 'foo', 'bar');
$this->assertInstanceOf(ApcuCache::class, $instance);
self::assertInstanceOf(ApcuCache::class, $instance);
}

public function testConstructorSetsTtl(): void
Expand All @@ -57,7 +57,7 @@ public function testConstructorSetsTtl(): void
sleep($ttl * 2);

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

public function testConstructorSetsReloadOnMiss(): void
Expand All @@ -74,7 +74,7 @@ public function testConstructorSetsReloadOnMiss(): void

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

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

$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
$this->assertSame($expected, $actual);
self::assertSame($expected, $actual);
}
}
36 changes: 18 additions & 18 deletions tests/Cache/ApcuCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testConstructorLoadsCache(): void
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);

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

public function testConstructorSetsTtl(): void
Expand All @@ -65,9 +65,9 @@ public function testConstructorSetsTtl(): void
sleep($ttl * 2);

apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
$this->assertFalse($success);
self::assertFalse($success);
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY, $success);
$this->assertFalse($success);
self::assertFalse($success);
}

public function testConstructorSetsReloadOnMiss(): void
Expand All @@ -89,7 +89,7 @@ public function testConstructorSetsReloadOnMiss(): void

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

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

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

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

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

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

$actual = apcu_fetch($lock);
$this->assertSame(1, $actual);
self::assertSame(1, $actual);
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
$this->assertFalse($success);
self::assertFalse($success);
}

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

$actual = $cache->get($msgid);
$this->assertSame($expected, $actual);
self::assertSame($expected, $actual);
}

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

$actual = $cache->get($expected);
$this->assertSame($expected, $actual);
self::assertSame($expected, $actual);
}

public function testStoresMsgidOnCacheMiss(): void
Expand All @@ -170,7 +170,7 @@ public function testStoresMsgidOnCacheMiss(): void
$cache->get($expected);

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

public function testGetReloadsOnCacheMiss(): void
Expand All @@ -184,7 +184,7 @@ public function testGetReloadsOnCacheMiss(): void

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

public function testReloadOnMissHonorsLock(): void
Expand All @@ -207,7 +207,7 @@ public function testReloadOnMissHonorsLock(): void
});
$actual = $method->invoke($cache, $msgid);

$this->assertSame($expected, $actual);
self::assertSame($expected, $actual);
}

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

$actual = $cache->get($msgid);
$this->assertSame($expected, $actual);
self::assertSame($expected, $actual);
}

public function testHasReturnsFalse(): void
{
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
$actual = $cache->has('Column');
$this->assertFalse($actual);
self::assertFalse($actual);
}

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

public function testSetAllSetsTranslations(): void
Expand All @@ -248,7 +248,7 @@ public function testSetAllSetsTranslations(): void

foreach ($translations as $msgid => $expected) {
$actual = $cache->get($msgid);
$this->assertEquals($expected, $actual);
self::assertSame($expected, $actual);
}
}

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

$msgstr = $cache->get($msgid);
$actual = explode(chr(0), $msgstr);
$this->assertSame($expected, $actual);
self::assertSame($expected, $actual);
}
}
Loading

0 comments on commit b5cc441

Please sign in to comment.