revert scalar type hints to retain support for PHP < 7.0
This commit is contained in:
@@ -72,7 +72,7 @@ abstract class AbstractData
|
||||
* @param array $paste
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function create(string $pasteid, array $paste);
|
||||
abstract public function create($pasteid, array $paste);
|
||||
|
||||
/**
|
||||
* Read a paste.
|
||||
@@ -81,7 +81,7 @@ abstract class AbstractData
|
||||
* @param string $pasteid
|
||||
* @return stdClass|false
|
||||
*/
|
||||
abstract public function read(string $pasteid);
|
||||
abstract public function read($pasteid);
|
||||
|
||||
/**
|
||||
* Delete a paste and its discussion.
|
||||
@@ -89,7 +89,7 @@ abstract class AbstractData
|
||||
* @access public
|
||||
* @param string $pasteid
|
||||
*/
|
||||
abstract public function delete(string $pasteid);
|
||||
abstract public function delete($pasteid);
|
||||
|
||||
/**
|
||||
* Test if a paste exists.
|
||||
@@ -98,7 +98,7 @@ abstract class AbstractData
|
||||
* @param string $pasteid
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function exists(string $pasteid);
|
||||
abstract public function exists($pasteid);
|
||||
|
||||
/**
|
||||
* Create a comment in a paste.
|
||||
@@ -110,7 +110,7 @@ abstract class AbstractData
|
||||
* @param array $comment
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function createComment(string $pasteid, string $parentid, string $commentid, array $comment);
|
||||
abstract public function createComment($pasteid, $parentid, $commentid, array $comment);
|
||||
|
||||
/**
|
||||
* Read all comments of paste.
|
||||
@@ -119,7 +119,7 @@ abstract class AbstractData
|
||||
* @param string $pasteid
|
||||
* @return array
|
||||
*/
|
||||
abstract public function readComments(string $pasteid);
|
||||
abstract public function readComments($pasteid);
|
||||
|
||||
/**
|
||||
* Test if a comment exists.
|
||||
@@ -130,7 +130,7 @@ abstract class AbstractData
|
||||
* @param string $commentid
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function existsComment(string $pasteid, string $parentid, string $commentid);
|
||||
abstract public function existsComment($pasteid, $parentid, $commentid);
|
||||
|
||||
/**
|
||||
* Returns up to batch size number of paste ids that have expired
|
||||
@@ -139,7 +139,7 @@ abstract class AbstractData
|
||||
* @param int $batchsize
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function _getExpiredPastes(int $batchsize);
|
||||
abstract protected function _getExpiredPastes($batchsize);
|
||||
|
||||
/**
|
||||
* Perform a purge of old pastes, at most the given batchsize is deleted.
|
||||
|
||||
@@ -154,7 +154,7 @@ class Database extends AbstractData
|
||||
* @param array $paste
|
||||
* @return bool
|
||||
*/
|
||||
public function create(string $pasteid, array $paste)
|
||||
public function create($pasteid, array $paste)
|
||||
{
|
||||
if (
|
||||
array_key_exists($pasteid, self::$_cache)
|
||||
@@ -223,7 +223,7 @@ class Database extends AbstractData
|
||||
* @param string $pasteid
|
||||
* @return array|false
|
||||
*/
|
||||
public function read(string $pasteid)
|
||||
public function read($pasteid)
|
||||
{
|
||||
if (array_key_exists($pasteid, self::$_cache)) {
|
||||
return self::$_cache[$pasteid];
|
||||
@@ -287,7 +287,7 @@ class Database extends AbstractData
|
||||
* @access public
|
||||
* @param string $pasteid
|
||||
*/
|
||||
public function delete(string $pasteid)
|
||||
public function delete($pasteid)
|
||||
{
|
||||
self::_exec(
|
||||
'DELETE FROM ' . self::_sanitizeIdentifier('paste') .
|
||||
@@ -311,7 +311,7 @@ class Database extends AbstractData
|
||||
* @param string $pasteid
|
||||
* @return bool
|
||||
*/
|
||||
public function exists(string $pasteid)
|
||||
public function exists($pasteid)
|
||||
{
|
||||
if (
|
||||
!array_key_exists($pasteid, self::$_cache)
|
||||
@@ -331,7 +331,7 @@ class Database extends AbstractData
|
||||
* @param array $comment
|
||||
* @return bool
|
||||
*/
|
||||
public function createComment(string $pasteid, string $parentid, string $commentid, array $comment)
|
||||
public function createComment($pasteid, $parentid, $commentid, array $comment)
|
||||
{
|
||||
if (array_key_exists('data', $comment)) {
|
||||
$version = 1;
|
||||
@@ -370,7 +370,7 @@ class Database extends AbstractData
|
||||
* @param string $pasteid
|
||||
* @return array
|
||||
*/
|
||||
public function readComments(string $pasteid)
|
||||
public function readComments($pasteid)
|
||||
{
|
||||
$rows = self::_select(
|
||||
'SELECT * FROM ' . self::_sanitizeIdentifier('comment') .
|
||||
@@ -414,7 +414,7 @@ class Database extends AbstractData
|
||||
* @param string $commentid
|
||||
* @return bool
|
||||
*/
|
||||
public function existsComment(string $pasteid, string $parentid, string $commentid)
|
||||
public function existsComment($pasteid, $parentid, $commentid)
|
||||
{
|
||||
return (bool) self::_select(
|
||||
'SELECT dataid FROM ' . self::_sanitizeIdentifier('comment') .
|
||||
@@ -456,7 +456,7 @@ class Database extends AbstractData
|
||||
* @throws PDOException
|
||||
* @return bool
|
||||
*/
|
||||
private static function _exec(string $sql, array $params)
|
||||
private static function _exec($sql, array $params)
|
||||
{
|
||||
$statement = self::$_db->prepare($sql);
|
||||
$result = $statement->execute($params);
|
||||
@@ -475,7 +475,7 @@ class Database extends AbstractData
|
||||
* @throws PDOException
|
||||
* @return array
|
||||
*/
|
||||
private static function _select(string $sql, array $params, bool $firstOnly = false)
|
||||
private static function _select($sql, array $params, bool $firstOnly = false)
|
||||
{
|
||||
$statement = self::$_db->prepare($sql);
|
||||
$statement->execute($params);
|
||||
|
||||
@@ -29,7 +29,7 @@ class Filesystem extends AbstractData
|
||||
* @param array $options
|
||||
* @return Filesystem
|
||||
*/
|
||||
public static function getInstance($options = null)
|
||||
public static function getInstance(array $options)
|
||||
{
|
||||
// if needed initialize the singleton
|
||||
if (!(self::$_instance instanceof self)) {
|
||||
@@ -53,7 +53,7 @@ class Filesystem extends AbstractData
|
||||
* @param array $paste
|
||||
* @return bool
|
||||
*/
|
||||
public function create($pasteid, $paste)
|
||||
public function create($pasteid, array $paste)
|
||||
{
|
||||
$storagedir = self::_dataid2path($pasteid);
|
||||
$file = $storagedir . $pasteid . '.php';
|
||||
@@ -121,7 +121,7 @@ class Filesystem extends AbstractData
|
||||
* @param string $pasteid
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($pasteid)
|
||||
public functio(($pasteid)
|
||||
{
|
||||
$basePath = self::_dataid2path($pasteid) . $pasteid;
|
||||
$pastePath = $basePath . '.php';
|
||||
@@ -155,7 +155,7 @@ class Filesystem extends AbstractData
|
||||
* @param array $comment
|
||||
* @return bool
|
||||
*/
|
||||
public function createComment($pasteid, $parentid, $commentid, $comment)
|
||||
public function createComment($pasteid, $parentid, $commentid, array $comment)
|
||||
{
|
||||
$storagedir = self::_dataid2discussionpath($pasteid);
|
||||
$file = $storagedir . $pasteid . '.' . $commentid . '.' . $parentid . '.php';
|
||||
@@ -230,7 +230,7 @@ class Filesystem extends AbstractData
|
||||
* @param int $batchsize
|
||||
* @return array
|
||||
*/
|
||||
protected function _getExpiredPastes($batchsize)
|
||||
protected function _getExpiredPastes(int $batchsize)
|
||||
{
|
||||
$pastes = array();
|
||||
$mainpath = DataStore::getPath();
|
||||
|
||||
Reference in New Issue
Block a user