diff --git a/src/composer.lock b/src/composer.lock index 3ab3a8e..36a3ef7 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -107,11 +107,11 @@ }, { "name": "bit-badger/pdo-document", - "version": "v1.0.0-beta2", + "version": "v1.0.0-beta5", "source": { "type": "git", "url": "https://git.bitbadger.solutions/bit-badger/pdo-document", - "reference": "50854275a8b39074966cf00370f30b3e68edc6e7" + "reference": "1a37b009ea0fd5d5af5fee6b73c8f839484b4001" }, "require": { "ext-pdo": "*", @@ -120,7 +120,8 @@ "phpoption/phpoption": "^1.9" }, "require-dev": { - "phpunit/phpunit": "^11" + "phpunit/phpunit": "^11", + "square/pjson": "^0.5.0" }, "type": "library", "autoload": { @@ -155,20 +156,20 @@ "rss": "https://git.bitbadger.solutions/bit-badger/pdo-document.rss", "source": "https://git.bitbadger.solutions/bit-badger/pdo-document" }, - "time": "2024-06-25T14:42:26+00:00" + "time": "2024-07-04T17:16:04+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", "shasum": "" }, "require": { @@ -220,7 +221,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.0" + "source": "https://github.com/composer/semver/tree/3.4.2" }, "funding": [ { @@ -236,7 +237,7 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2024-07-12T11:35:52+00:00" }, { "name": "graham-campbell/result-type", @@ -302,22 +303,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.8.1", + "version": "7.9.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + "reference": "84ac2b2afc44e40d3e8e658a45d68d6d20437612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/84ac2b2afc44e40d3e8e658a45d68d6d20437612", + "reference": "84ac2b2afc44e40d3e8e658a45d68d6d20437612", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -328,9 +329,9 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -408,7 +409,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.0" }, "funding": [ { @@ -424,20 +425,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:35:24+00:00" + "time": "2024-07-18T11:52:56+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", "shasum": "" }, "require": { @@ -445,7 +446,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -491,7 +492,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.2" + "source": "https://github.com/guzzle/promises/tree/2.0.3" }, "funding": [ { @@ -507,20 +508,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:19:20+00:00" + "time": "2024-07-18T10:29:17+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -535,8 +536,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -607,7 +608,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -623,7 +624,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "http-interop/http-factory-guzzle", diff --git a/src/lib/Domain/Request.php b/src/lib/Domain/Request.php index 8cb9656..04e9d72 100644 --- a/src/lib/Domain/Request.php +++ b/src/lib/Domain/Request.php @@ -60,7 +60,7 @@ class Request implements JsonSerializable */ public function isAnswered(): bool { - return $this->history[0]->action == RequestAction::Answered; + return $this->history[0]->action === RequestAction::Answered; } /** diff --git a/src/public/request/save.php b/src/public/request/save.php index 0d56f86..f085b94 100644 --- a/src/public/request/save.php +++ b/src/public/request/save.php @@ -29,15 +29,15 @@ switch ($_SERVER['REQUEST_METHOD']) { $req = Request::byId($_PATCH['requestId'])->getOrCall(not_found(...)); $patch = []; // update recurrence if changed - if ($recurrence != $req->recurrence) { + if ($recurrence !== $req->recurrence) { $patch['recurrence'] = $recurrence; - if ($recurrence->period == RecurrencePeriod::Immediate) { + if ($recurrence->period === RecurrencePeriod::Immediate) { RemoveFields::byId(Table::REQUEST, $req->id, ['showAfter']); } } // append history $upd8Text = trim($_PATCH['requestText']); - $text = $upd8Text == '' || $upd8Text == $req->currentText() ? null : $upd8Text; + $text = empty($upd8Text) || $upd8Text === $req->currentText() ? null : $upd8Text; array_unshift($req->history, new History($now->format('c'), RequestAction::from($_PATCH['status']), $text)); $patch['history'] = $req->history; Patch::byId(Table::REQUEST, $req->id, $patch); diff --git a/src/start.php b/src/start.php index e889aa7..27cd6c8 100644 --- a/src/start.php +++ b/src/start.php @@ -33,7 +33,7 @@ Definition::ensureTable(Table::REQUEST); Definition::ensureFieldIndex(Table::REQUEST, 'user', ['userId']); $_PATCH = []; -if ($_SERVER['REQUEST_METHOD'] ?? '' == 'PATCH') parse_str(file_get_contents('php://input'), $_PATCH); +if ($_SERVER['REQUEST_METHOD'] ?? '' === 'PATCH') parse_str(file_get_contents('php://input'), $_PATCH); /** * Return a 404 and exit @@ -78,7 +78,7 @@ function hide_modal(string $name): void */ function validate_request(string $id, array $methods, bool $redirect = true): Request { - if (sizeof(array_filter($methods, fn($it) => $_SERVER['REQUEST_METHOD'] == $it)) == 0) not_found(); + if (empty(array_filter($methods, fn($it) => $_SERVER['REQUEST_METHOD'] === $it))) not_found(); Auth::requireUser($redirect);