From 3bb4be3127c539526f35e8d4c59ce8fc06182f4c Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 5 Dec 2024 18:23:11 -0500 Subject: [PATCH] WIP on PHP 8.4 conversion --- .gitignore | 3 + src/composer.json | 5 +- src/composer.lock | 303 +++++++++++++---------- src/convert-from-v3.php | 7 +- src/lib/Domain/Note.php | 4 +- src/lib/Domain/Request.php | 8 +- src/lib/Table.php | 2 +- src/lib/UI/Component.php | 6 +- src/public/components/request/snooze.php | 2 +- src/public/request/full.php | 2 +- src/public/request/note.php | 4 +- src/public/request/prayed.php | 2 +- src/public/requests/active.php | 2 +- src/public/requests/answered.php | 2 +- src/public/requests/snoozed.php | 2 +- src/start.php | 7 +- 16 files changed, 204 insertions(+), 157 deletions(-) diff --git a/.gitignore b/.gitignore index c20d84a..4dace49 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ # PHP ignore files src/vendor src/.env + +# databases +src/data/*.db diff --git a/src/composer.json b/src/composer.json index c54d440..2a09ca0 100644 --- a/src/composer.json +++ b/src/composer.json @@ -1,11 +1,10 @@ { "name": "bit-badger/my-prayer-journal", - "minimum-stability": "beta", "require": { - "php": ">=8.2", + "php": ">=8.4", "ext-pdo": "*", "ext-sqlite3": "*", - "bit-badger/pdo-document": "^1", + "bit-badger/pdo-document": "^2", "guzzlehttp/guzzle": "^7.8", "guzzlehttp/psr7": "^2.6", "http-interop/http-factory-guzzle": "^1.2", diff --git a/src/composer.lock b/src/composer.lock index 36a3ef7..1838962 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d03cca0e9df6892b1154d46aa43ddfe9", + "content-hash": "bc1634b2de4b7620e11b44a3ab432290", "packages": [ { "name": "auth0/auth0-php", - "version": "8.11.1", + "version": "8.13.0", "source": { "type": "git", "url": "https://github.com/auth0/auth0-PHP.git", - "reference": "5d132ad4b3b95c5d5d342d09088d469568bfa627" + "reference": "3acf0f4d847f355eada5ac3f3336b175238c8ef1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/auth0/auth0-PHP/zipball/5d132ad4b3b95c5d5d342d09088d469568bfa627", - "reference": "5d132ad4b3b95c5d5d342d09088d469568bfa627", + "url": "https://api.github.com/repos/auth0/auth0-PHP/zipball/3acf0f4d847f355eada5ac3f3336b175238c8ef1", + "reference": "3acf0f4d847f355eada5ac3f3336b175238c8ef1", "shasum": "" }, "require": { @@ -32,19 +32,19 @@ "psr/http-message-implementation": "^1" }, "require-dev": { - "ergebnis/composer-normalize": "^2", - "friendsofphp/php-cs-fixer": "^3", - "mockery/mockery": "^1", - "pestphp/pest": "^2", - "phpstan/phpstan": "^1", - "phpstan/phpstan-strict-rules": "^1", - "psr-mock/http": "^1", - "rector/rector": "0.17.6", - "spatie/ray": "^1", + "ergebnis/composer-normalize": "~2.43.0", + "friendsofphp/php-cs-fixer": "~3.59.0", + "mockery/mockery": "~1.6.0", + "pestphp/pest": "~2.34.0", + "phpstan/phpstan": "~1.11.0", + "phpstan/phpstan-strict-rules": "~1.6.0", + "psr-mock/http": "~1.0.0", + "rector/rector": "~0.17.0", + "spatie/ray": "~1.41.0", "symfony/cache": "^4 || ^5 || ^6", "symfony/event-dispatcher": "^4 || ^5 || ^6", - "vimeo/psalm": "^5", - "wikimedia/composer-merge-plugin": "^2" + "vimeo/psalm": "~5.25.0", + "wikimedia/composer-merge-plugin": "~2.1.0" }, "suggest": { "psr/cache-implementation": "(PSR-6 Cache) Improve performance by avoiding making redundant network requests.", @@ -101,26 +101,72 @@ ], "support": { "issues": "https://github.com/auth0/auth0-PHP/issues", - "source": "https://github.com/auth0/auth0-PHP/tree/8.11.1" + "source": "https://github.com/auth0/auth0-PHP/tree/8.13.0" }, - "time": "2024-01-11T15:28:10+00:00" + "time": "2024-11-15T11:08:53+00:00" + }, + { + "name": "bit-badger/inspired-by-fsharp", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp", + "reference": "c61ff7a831f152f6f9d6cbd1d30604924fa5c83e" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "pestphp/pest": "^3.5", + "phpoption/phpoption": "^1" + }, + "type": "library", + "autoload": { + "psr-4": { + "BitBadger\\InspiredByFSharp\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel J. Summers", + "email": "daniel@bitbadger.solutions", + "homepage": "https://bitbadger.solutions", + "role": "Developer" + } + ], + "description": "PHP utility classes whose functionality is inspired by their F# counterparts", + "keywords": [ + "option", + "result" + ], + "support": { + "email": "daniel@bitbadger.solutions", + "rss": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp.rss", + "source": "https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp" + }, + "time": "2024-11-21T01:27:18+00:00" }, { "name": "bit-badger/pdo-document", - "version": "v1.0.0-beta5", + "version": "v2.0.0", "source": { "type": "git", "url": "https://git.bitbadger.solutions/bit-badger/pdo-document", - "reference": "1a37b009ea0fd5d5af5fee6b73c8f839484b4001" + "reference": "85b461e44132894374265026d6cfe9923d1c17d9" }, "require": { + "bit-badger/inspired-by-fsharp": "^2", "ext-pdo": "*", "netresearch/jsonmapper": "^4", - "php": ">=8.2", - "phpoption/phpoption": "^1.9" + "php": ">=8.4" }, "require-dev": { - "phpunit/phpunit": "^11", + "pestphp/pest": "^3.2", + "phpstan/phpstan": "^1.12", "square/pjson": "^0.5.0" }, "type": "library", @@ -152,32 +198,33 @@ "sqlite" ], "support": { + "docs": "https://bitbadger.solutions/open-source/pdo-document/", "email": "daniel@bitbadger.solutions", "rss": "https://git.bitbadger.solutions/bit-badger/pdo-document.rss", "source": "https://git.bitbadger.solutions/bit-badger/pdo-document" }, - "time": "2024-07-04T17:16:04+00:00" + "time": "2024-11-21T03:45:17+00:00" }, { "name": "composer/semver", - "version": "3.4.2", + "version": "3.4.3", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", - "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -221,7 +268,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.2" + "source": "https://github.com/composer/semver/tree/3.4.3" }, "funding": [ { @@ -237,28 +284,28 @@ "type": "tidelift" } ], - "time": "2024-07-12T11:35:52+00:00" + "time": "2024-09-19T14:15:21+00:00" }, { "name": "graham-campbell/result-type", - "version": "v1.1.2", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" + "phpoption/phpoption": "^1.9.3" }, "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "autoload": { @@ -287,7 +334,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" }, "funding": [ { @@ -299,20 +346,20 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:16:48+00:00" + "time": "2024-07-20T21:45:45+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.9.0", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "84ac2b2afc44e40d3e8e658a45d68d6d20437612" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/84ac2b2afc44e40d3e8e658a45d68d6d20437612", - "reference": "84ac2b2afc44e40d3e8e658a45d68d6d20437612", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { @@ -409,7 +456,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.0" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -425,20 +472,20 @@ "type": "tidelift" } ], - "time": "2024-07-18T11:52:56+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", - "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", "shasum": "" }, "require": { @@ -492,7 +539,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.3" + "source": "https://github.com/guzzle/promises/tree/2.0.4" }, "funding": [ { @@ -508,7 +555,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T10:29:17+00:00" + "time": "2024-10-17T10:06:22+00:00" }, { "name": "guzzlehttp/psr7", @@ -686,16 +733,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.4.1", + "version": "v4.5.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0" + "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/132c75c7dd83e45353ebb9c6c9f591952995bbf0", - "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8e76efb98ee8b6afc54687045e1b8dba55ac76e5", + "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5", "shasum": "" }, "require": { @@ -731,22 +778,22 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.4.1" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.5.0" }, - "time": "2024-01-31T06:18:54+00:00" + "time": "2024-09-08T10:13:13+00:00" }, { "name": "php-http/discovery", - "version": "1.19.4", + "version": "1.20.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "0700efda8d7526335132360167315fdab3aeb599" + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/0700efda8d7526335132360167315fdab3aeb599", - "reference": "0700efda8d7526335132360167315fdab3aeb599", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", "shasum": "" }, "require": { @@ -810,22 +857,22 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.19.4" + "source": "https://github.com/php-http/discovery/tree/1.20.0" }, - "time": "2024-03-29T13:00:05+00:00" + "time": "2024-10-02T11:20:13+00:00" }, { "name": "php-http/multipart-stream-builder", - "version": "1.3.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "ed56da23b95949ae4747378bed8a5b61a2fdae24" + "reference": "10086e6de6f53489cca5ecc45b6f468604d3460e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/ed56da23b95949ae4747378bed8a5b61a2fdae24", - "reference": "ed56da23b95949ae4747378bed8a5b61a2fdae24", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/10086e6de6f53489cca5ecc45b6f468604d3460e", + "reference": "10086e6de6f53489cca5ecc45b6f468604d3460e", "shasum": "" }, "require": { @@ -866,22 +913,22 @@ ], "support": { "issues": "https://github.com/php-http/multipart-stream-builder/issues", - "source": "https://github.com/php-http/multipart-stream-builder/tree/1.3.1" + "source": "https://github.com/php-http/multipart-stream-builder/tree/1.4.2" }, - "time": "2024-06-10T14:51:55+00:00" + "time": "2024-09-04T13:22:54+00:00" }, { "name": "phpoption/phpoption", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", "shasum": "" }, "require": { @@ -889,13 +936,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "1.9-dev" @@ -931,7 +978,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" }, "funding": [ { @@ -943,7 +990,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T21:59:55+00:00" + "time": "2024-07-20T21:41:07+00:00" }, { "name": "psr-discovery/all", @@ -1166,16 +1213,16 @@ }, { "name": "psr-discovery/discovery", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/psr-discovery/discovery.git", - "reference": "9fb31dca2030accd9d3de21fb8806478e9df5b2b" + "reference": "f94a41c150efaffd6f4c23ef95e31cae7a83704f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psr-discovery/discovery/zipball/9fb31dca2030accd9d3de21fb8806478e9df5b2b", - "reference": "9fb31dca2030accd9d3de21fb8806478e9df5b2b", + "url": "https://api.github.com/repos/psr-discovery/discovery/zipball/f94a41c150efaffd6f4c23ef95e31cae7a83704f", + "reference": "f94a41c150efaffd6f4c23ef95e31cae7a83704f", "shasum": "" }, "require": { @@ -1237,9 +1284,9 @@ ], "support": { "issues": "https://github.com/psr-discovery/discovery/issues", - "source": "https://github.com/psr-discovery/discovery/tree/1.1.1" + "source": "https://github.com/psr-discovery/discovery/tree/1.1.2" }, - "time": "2024-03-04T21:26:05+00:00" + "time": "2024-08-09T07:04:30+00:00" }, { "name": "psr-discovery/event-dispatcher-implementations", @@ -1849,16 +1896,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -1893,9 +1940,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "ralouphie/getallheaders", @@ -1943,16 +1990,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "shasum": "" }, "require": { @@ -1990,7 +2037,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" }, "funding": [ { @@ -2006,24 +2053,24 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -2069,7 +2116,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -2085,24 +2132,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -2149,7 +2196,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -2165,24 +2212,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -2229,7 +2276,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -2245,27 +2292,27 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v5.6.0", + "version": "v5.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", + "graham-campbell/result-type": "^1.1.3", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", + "phpoption/phpoption": "^1.9.3", "symfony/polyfill-ctype": "^1.24", "symfony/polyfill-mbstring": "^1.24", "symfony/polyfill-php80": "^1.24" @@ -2282,7 +2329,7 @@ "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "5.6-dev" @@ -2317,7 +2364,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" }, "funding": [ { @@ -2329,17 +2376,17 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:43:29+00:00" + "time": "2024-07-20T21:52:34+00:00" } ], "packages-dev": [], "aliases": [], - "minimum-stability": "beta", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.2", + "php": ">=8.4", "ext-pdo": "*", "ext-sqlite3": "*" }, diff --git a/src/convert-from-v3.php b/src/convert-from-v3.php index 0b2685d..50c06b5 100644 --- a/src/convert-from-v3.php +++ b/src/convert-from-v3.php @@ -10,14 +10,13 @@ require 'start.php'; echo 'Retrieving v3 requests...' . PHP_EOL; Configuration::resetPDO(); -Configuration::$pdoDSN = 'pgsql:host=localhost;user=mpj;password=devpassword;dbname=mpj'; +Configuration::useDSN('pgsql:host=localhost;user=mpj;password=devpassword;dbname=mpj'); $reqs = Custom::array('SELECT data FROM mpj.request', [], new ArrayMapper()); echo 'Found ' . sizeof($reqs) . ' requests; migrating to v4...' . PHP_EOL; Configuration::resetPDO(); -Configuration::$mode = Mode::SQLite; -Configuration::$pdoDSN = 'sqlite:./data/mpj.db'; +Configuration::useDSN('sqlite:./data/mpj.db'); Configuration::$autoId = AutoId::RandomString; Configuration::$idStringLength = 12; @@ -26,7 +25,7 @@ Definition::ensureTable(Table::REQUEST); /** Convert dates to the same format */ function convertDate(string $date): string { - return (new DateTimeImmutable($date))->format('c'); + return new DateTimeImmutable($date)->format('c'); } foreach ($reqs as $reqJson) { diff --git a/src/lib/Domain/Note.php b/src/lib/Domain/Note.php index ba95e68..4100cec 100644 --- a/src/lib/Domain/Note.php +++ b/src/lib/Domain/Note.php @@ -2,6 +2,7 @@ namespace MyPrayerJournal\Domain; +use BitBadger\InspiredByFSharp\Option; use BitBadger\PDODocument\DocumentException; /** @@ -24,7 +25,6 @@ class Note */ public static function byRequestId(string $id): array { - $req = Request::byId($id); - return $req->isDefined() ? $req->get()->notes : []; + return Request::byId($id)->map(fn(Request $it) => Option::Some($it->notes))->getOrDefault([]); } } diff --git a/src/lib/Domain/Request.php b/src/lib/Domain/Request.php index 04e9d72..599bcba 100644 --- a/src/lib/Domain/Request.php +++ b/src/lib/Domain/Request.php @@ -2,13 +2,13 @@ namespace MyPrayerJournal\Domain; +use BitBadger\InspiredByFSharp\Option; use BitBadger\PDODocument\{Custom, DocumentException, DocumentList, Find}; use BitBadger\PDODocument\Mapper\DocumentMapper; use DateTimeImmutable; use Exception; use JsonSerializable; use MyPrayerJournal\Table; -use PhpOption\{None, Option}; /** * A prayer request @@ -111,8 +111,8 @@ class Request implements JsonSerializable */ public static function byId(string $id): Option { - $req = Find::byId(Table::REQUEST, $id, self::class); - return ($req->getOrElse(new Request('x'))->userId == $_SESSION['user_id']) ? $req : None::create(); + return Find::byId(Table::REQUEST, $id, self::class) + ->map(fn(Request $it) => $it->userId === $_SESSION['user_id'] ? Option::Some($it) : Option::None()); } /** @@ -187,7 +187,7 @@ class Request implements JsonSerializable */ public static function answered(): DocumentList { - return self::forUser(false); + return self::forUser(active: false); } /** diff --git a/src/lib/Table.php b/src/lib/Table.php index 841cf7d..90d438a 100644 --- a/src/lib/Table.php +++ b/src/lib/Table.php @@ -8,5 +8,5 @@ namespace MyPrayerJournal; class Table { /** @var string The prayer request table used by myPrayerJournal */ - const REQUEST = 'request'; + const string REQUEST = 'request'; } diff --git a/src/lib/UI/Component.php b/src/lib/UI/Component.php index cecb247..831d3fa 100644 --- a/src/lib/UI/Component.php +++ b/src/lib/UI/Component.php @@ -32,11 +32,11 @@ class Component { Layout::bareHead(); $reqs = Request::forJournal(); - if ($reqs->hasItems()) { ?> + if ($reqs->hasItems) { ?>
 '; - foreach ($reqs->items() as /** @var Request $req */ $req) { ?> + foreach ($reqs->items as /** @var Request $req */ $req) { ?>