Files
FreshRSS/lib/Minz/PdoMysql.php
dependabot[bot] 226239d157 Bump phpstan/phpstan from 2.1.46 to 2.1.54 (#8753)
* Bump phpstan/phpstan from 2.1.46 to 2.1.54

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-version: 2.1.54
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fixes some PHPStan issues, including compatibility PHP 8.2-
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/8713

Co-authored-by: Copilot <copilot@github.com>

* Bump PHPStan-strict-rules

* Fix PHPStan for PHP 8.3

* Ignore PHPStan warning for PHP 8.2 and PHP 8.3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Copilot <copilot@github.com>
2026-05-02 21:16:27 +02:00

37 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
class Minz_PdoMysql extends Minz_Pdo {
/**
* @param array<int,int|string|bool>|null $options
* @throws PDOException
*/
public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null) {
parent::__construct($dsn, $username, $passwd, $options);
if (class_exists('Pdo\Mysql')) {
assert(is_int(Pdo\Mysql::ATTR_USE_BUFFERED_QUERY)); // For PHPStan with PHP 8.4+
$this->setAttribute(Pdo\Mysql::ATTR_USE_BUFFERED_QUERY, false);
} else {
$this->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); // PHP < 8.4
}
}
#[\Override]
public function dbType(): string {
return 'mysql';
}
/**
* @throws PDOException if the attribute `PDO::ATTR_ERRMODE` is set to `PDO::ERRMODE_EXCEPTION`
*/
#[\Override]
public function lastInsertId(?string $name = null): string|false {
return parent::lastInsertId(); //We discard the name, only used by PostgreSQL
}
}