From ea8c2e3233e063bd34fb973851c278f786124f76 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 7 May 2016 17:48:53 +0200 Subject: [PATCH] Add \PDOStatement methods as PHPDoc methods to PreparedStatement --- .../statement/PreparedStatement.class.php | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php b/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php index c60e9422e3..9be0d7ce3e 100644 --- a/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php +++ b/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php @@ -12,16 +12,20 @@ use wcf\system\WCF; * Represents a prepared statements based upon pdo statements. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.database.statement * @category Community Framework + * + * @method boolean closeCursor() + * @method mixed fetch($fetch_style, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = 0) + * @method mixed fetchColumn($column_number = 0) */ class PreparedStatement { /** * database object - * @var \wcf\system\database\Database + * @var Database */ protected $database = null; @@ -29,7 +33,7 @@ class PreparedStatement { * SQL query parameters * @var array */ - protected $parameters = array(); + protected $parameters = []; /** * pdo statement object @@ -46,9 +50,9 @@ class PreparedStatement { /** * Creates a new PreparedStatement object. * - * @param \wcf\system\database\Database $database - * @param \PDOStatement $pdoStatement - * @param string $query SQL query + * @param Database $database + * @param \PDOStatement $pdoStatement + * @param string $query SQL query */ public function __construct(Database $database, \PDOStatement $pdoStatement, $query = '') { $this->database = $database; @@ -70,7 +74,7 @@ class PreparedStatement { } try { - return call_user_func_array(array($this->pdoStatement, $name), $arguments); + return call_user_func_array([$this->pdoStatement, $name], $arguments); } catch (\PDOException $e) { throw new DatabaseQueryException("Could call '".$name."' on '".$this->query."'", $e); @@ -83,7 +87,7 @@ class PreparedStatement { * @param array $parameters * @throws DatabaseQueryExecutionException */ - public function execute(array $parameters = array()) { + public function execute(array $parameters = []) { $this->parameters = $parameters; $this->database->incrementQueryCount(); @@ -177,7 +181,7 @@ class PreparedStatement { * @return DatabaseObject[] */ public function fetchObjects($className) { - $objects = array(); + $objects = []; while ($object = $this->fetchObject($className)) { $objects[] = $object; } -- 2.20.1