From cebc9acce64b52119fd5f8e42509ff40549c8f8c Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 4 Jun 2024 07:13:55 +0200 Subject: [PATCH 1/3] enable strict types in PHP --- bin/administration | 2 +- bin/configuration-test-generator | 4 ++-- bin/icon-test | 2 +- bin/migrate | 2 +- index.php | 2 +- lib/Configuration.php | 2 +- lib/Controller.php | 2 +- lib/Data/AbstractData.php | 2 +- lib/Data/Database.php | 2 +- lib/Data/Filesystem.php | 2 +- lib/Data/GoogleCloudStorage.php | 2 +- lib/Data/S3Storage.php | 2 +- lib/Filter.php | 2 +- lib/FormatV2.php | 2 +- lib/I18n.php | 2 +- lib/Json.php | 2 +- lib/Model.php | 2 +- lib/Model/AbstractModel.php | 2 +- lib/Model/Comment.php | 2 +- lib/Model/Paste.php | 2 +- lib/Persistence/AbstractPersistence.php | 2 +- lib/Persistence/PurgeLimiter.php | 2 +- lib/Persistence/ServerSalt.php | 2 +- lib/Persistence/TrafficLimiter.php | 2 +- lib/Request.php | 2 +- lib/View.php | 2 +- lib/Vizhash16x16.php | 2 +- lib/YourlsProxy.php | 2 +- tst/Bootstrap.php | 2 +- tst/ConfigurationTest.php | 2 +- tst/ControllerTest.php | 2 +- tst/ControllerWithDbTest.php | 2 +- tst/ControllerWithGcsTest.php | 2 +- tst/Data/DatabaseTest.php | 2 +- tst/Data/FilesystemTest.php | 2 +- tst/Data/GoogleCloudStorageTest.php | 2 +- tst/FilterTest.php | 2 +- tst/FormatV2Test.php | 2 +- tst/I18nTest.php | 2 +- tst/JsonApiTest.php | 2 +- tst/MigrateTest.php | 2 +- tst/ModelTest.php | 2 +- tst/Persistence/PurgeLimiterTest.php | 2 +- tst/Persistence/ServerSaltTest.php | 2 +- tst/Persistence/TrafficLimiterTest.php | 2 +- tst/RequestTest.php | 2 +- tst/ViewTest.php | 2 +- tst/Vizhash16x16Test.php | 2 +- tst/YourlsProxyTest.php | 2 +- 49 files changed, 50 insertions(+), 50 deletions(-) diff --git a/bin/administration b/bin/administration index 0a9a52e7..17b2e0f5 100755 --- a/bin/administration +++ b/bin/administration @@ -1,5 +1,5 @@ #!/usr/bin/env php - Date: Tue, 4 Jun 2024 07:27:45 +0200 Subject: [PATCH 2/3] address unit test failures due to strict typing --- lib/Data/AbstractData.php | 2 +- tst/I18nTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Data/AbstractData.php b/lib/Data/AbstractData.php index 922cdf5d..8e8c8bd5 100644 --- a/lib/Data/AbstractData.php +++ b/lib/Data/AbstractData.php @@ -181,7 +181,7 @@ abstract class AbstractData protected function getOpenSlot(array &$comments, $postdate) { if (array_key_exists($postdate, $comments)) { - $parts = explode('.', $postdate, 2); + $parts = explode('.', (string) $postdate, 2); if (!array_key_exists(1, $parts)) { $parts[1] = 0; } diff --git a/tst/I18nTest.php b/tst/I18nTest.php index 9c013f8b..14292400 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -198,7 +198,7 @@ class I18nTest extends TestCase $languageCount = 0; foreach ($languageIterator as $file) { ++$languageCount; - $this->assertTrue(copy($file, $path . DIRECTORY_SEPARATOR . $file->getBasename())); + $this->assertTrue(copy($file->getPathname(), $path . DIRECTORY_SEPARATOR . $file->getBasename())); } I18nMock::resetPath($path); From 662d0e1430ee4814bd0bbf0cf349d9d10074df34 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 4 Jun 2024 07:32:13 +0200 Subject: [PATCH 3/3] document change --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 395cbd76..c0797555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 1.7.4 (not yet released) * CHANGED: Saving markdown pastes uses `.md` extension instead of `.txt` (#1293) +* CHANGED: Enable strict type checking in PHP (#1350) * FIXED: Reset password input field on creation of new paste (#1194) * FIXED: Allow database schema upgrade to skip versions (#1343)