diff --git a/composer.json b/composer.json index 4b0f577..027160e 100644 --- a/composer.json +++ b/composer.json @@ -12,14 +12,14 @@ "require": { "php": ">=7.4", "ext-json": "*", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1 || ^2.0", "shrikeh/teapot": "^2.3.1", "theodorejb/peachy-sql": "^6.1" }, "require-dev": { "phpunit/phpunit": "^9.6", - "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.15" + "psalm/plugin-phpunit": "^0.19", + "vimeo/psalm": "^5.26" }, "autoload": { "psr-4": {"theodorejb\\Phaster\\": "src/"} diff --git a/src/Helpers.php b/src/Helpers.php index 51fb83c..7bcce89 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -84,14 +84,14 @@ public static function mapRows(\Generator $rows, array $fieldProps): array $nullParents = []; foreach ($aliasMap as $colName => $prop) { - if ($prop->getValue) { + if ($prop->getValue !== null) { /** @var mixed $value */ $value = ($prop->getValue)($row); } else { /** @var mixed $value */ $value = $row[$colName]; - if ($prop->type) { + if ($prop->type !== null) { settype($value, $prop->type); } elseif (is_string($value) && $prop->timeZone !== false) { $value = (new \DateTimeImmutable($value, $prop->timeZone))->format(\DateTime::ATOM); diff --git a/test/src/DbConnector.php b/test/src/DbConnector.php index fb105ca..009de12 100644 --- a/test/src/DbConnector.php +++ b/test/src/DbConnector.php @@ -41,8 +41,8 @@ public static function getMysqlConn(): mysqli self::$mysqlConn = new mysqli($c->getMysqlHost(), $c->getMysqlUser(), $c->getMysqlPassword(), $c->getMysqlDatabase(), $dbPort); - if (self::$mysqlConn->connect_error) { - throw new Exception('Failed to connect to MySQL: (' . self::$mysqlConn->connect_errno . ') ' . self::$mysqlConn->connect_error); + if (self::$mysqlConn->connect_error !== null) { + throw new Exception('Failed to connect to MySQL: ' . self::$mysqlConn->connect_error); } self::createMysqlTestTable(self::$mysqlConn);