diff --git a/Database/Query.php b/Database/Query.php index 82639e4..40355fd 100644 --- a/Database/Query.php +++ b/Database/Query.php @@ -637,7 +637,7 @@ public function where($key, $value = null, $op = '=', $bind = true) { if ($key === null) { return $this; - } elseif (is_callable($key) && is_object($key)) { // is a closure + } elseif ($key instanceof \Closure) { $this->_where_group(true, 'AND'); $key($this); $this->_where_group(false, 'OR'); @@ -698,7 +698,7 @@ public function or_where($key, $value = null, $op = '=', $bind = true) { if ($key === null) { return $this; - } elseif (is_callable($key) && is_object($key)) { + } elseif ($key instanceof \Closure) { $this->_where_group(true, 'OR'); $key($this); $this->_where_group(false, 'OR'); @@ -743,7 +743,7 @@ public function or_where($key, $value = null, $op = '=', $bind = true) */ public function where_group($inOut, $op = 'AND') { - if (is_callable($inOut) && is_object($inOut)) { + if ($inOut instanceof \Closure) { $this->_where_group(true, $op); $inOut($this); $this->_where_group(false, $op); diff --git a/Editor.php b/Editor.php index 1eabbd0..db8198a 100644 --- a/Editor.php +++ b/Editor.php @@ -86,9 +86,9 @@ class Editor extends Ext * an Editor payload * @param string $name The parameter name that the action should be read from. * - * @return string `Editor::ACTION_READ`, `Editor::ACTION_CREATE`, - * `Editor::ACTION_EDIT` or `Editor::ACTION_DELETE` indicating the request - * type. + * @return static::ACTION_* `Editor::ACTION_READ`, `Editor::ACTION_CREATE`, + * `Editor::ACTION_EDIT` or `Editor::ACTION_DELETE` indicating the request + * type. */ public static function action($http, $name = 'action') { @@ -189,7 +189,7 @@ public function __construct($db = null, $table = null, $pkey = null) /** @var array */ private $_out = array(); - /** @var array */ + /** @var array[] */ private $_events = array(); /** @var bool */ @@ -201,7 +201,7 @@ public function __construct($db = null, $table = null, $pkey = null) /** @var string Log output path */ private $_debugLog = ''; - /** @var callable */ + /** @var array */ private $_validator = array(); /** @var bool Enable true / catch when processing */ @@ -910,7 +910,7 @@ public function where($key = null, $value = null, $op = '=') return $this->_where; } - if (is_callable($key) && is_object($key)) { + if ($key instanceof \Closure) { $this->_where[] = $key; } else { $this->_where[] = array( @@ -953,8 +953,6 @@ public function write($_writeVal = null) * Process a request from the Editor client-side to get / set data. * * @param array $data Data to process - * - * @private */ private function _process($data) { @@ -1085,8 +1083,6 @@ private function _process($data) * server-side processing requests from DataTables). * * @return array DataTables get information - * - * @private */ private function _get($id = null, $http = null) { @@ -1226,8 +1222,6 @@ private function _get($id = null, $http = null) /** * Insert a new row in the database. - * - * @private */ private function _insert($values) { @@ -1285,8 +1279,6 @@ private function _insert($values) * @param string $id The DOM ID for the row that is being edited. * * @return array Row's data - * - * @private */ private function _update($id, $values) { @@ -1322,8 +1314,6 @@ private function _update($id, $values) /** * Delete one or more rows from the database. - * - * @private */ private function _remove($data) { @@ -1395,8 +1385,6 @@ private function _remove($data) * File upload. * * @param array $data Upload data - * - * @private */ private function _upload($data) { @@ -1466,8 +1454,6 @@ private function _upload($data) * @param number[] $ids Limit to a specific set of ids * * @return array File information - * - * @private */ private function _fileData($limitTable = null, $ids = null, $data = null) { @@ -1503,8 +1489,6 @@ private function _fileData($limitTable = null, $ids = null, $data = null) * @param Field[] $fields Fields to get file information about * @param string $limitTable Limit the data gathering to a single table * only - * - * @private */ private function _fileDataFields(&$files, $fields, $limitTable, $idsIn = null, $data = null) { @@ -1563,8 +1547,6 @@ private function _fileDataFields(&$files, $fields, $limitTable, $idsIn = null, $ /** * Run the file clean up. - * - * @private */ private function _fileClean() { @@ -1599,8 +1581,6 @@ private function _fileClean() * @param array $http Parameters from HTTP request * * @return array Server-side processing information array - * - * @private */ private function _ssp_query($query, $http) { @@ -1648,7 +1628,7 @@ private function _ssp_query($query, $http) * @param array $http HTTP variables (i.e. GET or POST) * @param int $index Index in the DataTables' submitted data * - * @returns string DB field name + * @return string DB field name * * @private Note that it is actually public for PHP 5.3 - thread 39810 */ @@ -1674,8 +1654,6 @@ public function _ssp_field($http, $index) * * @param \DataTables\Database\Query $query Query instance to apply sorting to * @param array $http HTTP variables (i.e. GET or POST) - * - * @private */ private function _ssp_sort($query, $http) { @@ -1921,8 +1899,6 @@ private function _constructSearchBuilderConditions($query, $data) * * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to * @param array $http HTTP variables (i.e. GET or POST) - * - * @private */ private function _ssp_filter($query, $http) { @@ -2052,8 +2028,6 @@ private function _ssp_filter($query, $http) * * @param \DataTables\Database\Query $query Query instance to apply the offset / limit to * @param array $http HTTP variables (i.e. GET or POST) - * - * @private */ private function _ssp_limit($query, $http) { @@ -2072,8 +2046,6 @@ private function _ssp_limit($query, $http) * Add local WHERE condition to query. * * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to - * - * @private */ private function _get_where($query) { @@ -2097,8 +2069,6 @@ private function _get_where($query) * @param string $type Matching name type * * @return Field Field instance - * - * @private */ private function _find_field($name, $type) { @@ -2126,8 +2096,6 @@ private function _find_field($name, $type) * * @return \DataTables\Database\Result Result from the query or null if no * query performed. - * - * @private */ private function _insert_or_update($id, $values) { @@ -2214,8 +2182,6 @@ private function _insert_or_update($id, $values) * * @return \DataTables\Database\Result Result from the query or null if no query * performed. - * - * @private */ private function _insert_or_update_table($table, $values, $where = null) { @@ -2304,8 +2270,6 @@ private function _insert_or_update_table($table, $values, $where = null) * @param string $pkey Database column name to match the ids on for the * delete condition. If not given the instance's base primary key is * used. - * - * @private */ private function _remove_table($table, $ids, $pkey = null) { @@ -2376,8 +2340,6 @@ private function _remove_table($table, $ids, $pkey = null) * Check the validity of the set options if we are doing a join, since * there are some conditions for this state. Will throw an error if not * valid. - * - * @private */ private function _prepJoin() { @@ -2417,9 +2379,7 @@ private function _prepJoin() * @param string $name SQL field * @param string $type Which part to get: `alias` (default) or `orig`. * - * @returns string Alias - * - * @private + * @return string Alias */ private function _alias($name, $type = 'alias') { @@ -2451,8 +2411,6 @@ private function _alias($name, $type = 'alias') * `column` * * @return string Part name - * - * @private */ private function _part($name, $type = 'table') { @@ -2486,8 +2444,6 @@ private function _part($name, $type = 'table') /** * Trigger an event. - * - * @private */ private function _trigger($eventName, &$arg1 = null, &$arg2 = null, &$arg3 = null, &$arg4 = null, &$arg5 = null) { diff --git a/Editor/Field.php b/Editor/Field.php index 724a6d0..d033d18 100644 --- a/Editor/Field.php +++ b/Editor/Field.php @@ -150,7 +150,7 @@ public function __construct($dbField = null, $name = null) /** @var mixed */ private $_setValue; - /** @var mixed */ + /** @var array[] */ private $_validator = array(); /** @var Upload */ @@ -315,7 +315,7 @@ public function options($table = null, $value = null, $label = null, $condition // Options class $this->_optsFn = null; $this->_opts = $table; - } elseif (is_callable($table) && is_object($table)) { + } elseif ($table instanceof \Closure) { // Function $this->_opts = null; $this->_optsFn = $table; @@ -360,7 +360,7 @@ public function searchPaneOptions($spInput = null) // Options class $this->_spoptsFn = null; $this->_spopts = $spInput; - } elseif (is_callable($spInput) && is_object($spInput)) { + } elseif ($spInput instanceof \Closure) { // Function $this->_spopts = null; $this->_spoptsFn = $spInput; @@ -387,7 +387,7 @@ public function searchBuilderOptions($sbInput = null) // Options class $this->_sboptsFn = null; $this->_sbopts = $sbInput; - } elseif (is_callable($sbInput) && is_object($sbInput)) { + } elseif ($spInput instanceof \Closure) { // Function $this->_sbopts = null; $this->_sboptsFn = $sbInput; @@ -871,7 +871,7 @@ public function xssSafety($val) * (get or set). * * @param mixed $val Value to be formatted - * @param mixed $data Full row data + * @param array $data Full row data * @param callable $formatter Formatting function to be called * @param array $opts Array of options to be passed to the formatter * @@ -918,7 +918,7 @@ private function _format($val, $data, $formatter, $opts) */ private function _getAssignedValue($val) { - return is_callable($val) && is_object($val) ? + return $val instanceof \Closure ? $val() : $val; } @@ -932,8 +932,6 @@ private function _getAssignedValue($val) * @param array $data Data source array to read from * * @return bool `true` if present, `false` otherwise - * - * @private */ private function _inData($name, $data) { diff --git a/Editor/Join.php b/Editor/Join.php index fb31f30..a6a3753 100644 --- a/Editor/Join.php +++ b/Editor/Join.php @@ -121,7 +121,7 @@ public function __construct($table = null, $type = 'object') /** @var string */ private $_customOrder; - /** @var callable[] */ + /** @var array */ private $_validators = array(); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -241,7 +241,7 @@ public function get($_ = null) * link table. * @param string $table Join table name, if using a link table * - * @returns Join This for chaining + * @return Join This for chaining * * @deprecated 1.5 Please use the {@see Join->link()} method rather than this * method now. @@ -443,7 +443,7 @@ public function where($key = null, $value = null, $op = '=') return $this->_where; } - if (is_callable($key) && is_object($key)) { + if ($key instanceof \Closure) { $this->_where[] = $key; } else { $this->_where[] = array( @@ -807,8 +807,6 @@ public function validate(&$errors, $editor, $data, $action) * Add local WHERE condition to query. * * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to - * - * @private */ private function _apply_where($query) { @@ -831,8 +829,6 @@ private function _apply_where($query) * @param \DataTables\Database $db Database reference to use * @param int $parentId Parent row's primary key value * @param string[] $data Data to be set for the join - * - * @private */ private function _insert($db, $parentId, $data) { @@ -877,8 +873,6 @@ private function _insert($db, $parentId, $data) * Prepare the instance to be run. * * @param Editor $editor Editor instance - * - * @private */ private function _prep($editor) { @@ -942,8 +936,6 @@ private function _prep($editor) * @param \DataTables\Database $db Database reference to use * @param int $parentId Parent row's primary key value * @param string[] $data Data to be set for the join - * - * @private */ private function _update_row($db, $parentId, $data) { @@ -997,9 +989,7 @@ private function _update_row($db, $parentId, $data) * * @param string $direction Direction: 'get' or 'set'. * - * @returns array Fields to include - * - * @private + * @return array Fields to include */ private function _fields($direction) { diff --git a/Editor/Upload.php b/Editor/Upload.php index db7d985..13a6033 100644 --- a/Editor/Upload.php +++ b/Editor/Upload.php @@ -663,7 +663,7 @@ private function _dbExec($upload, $db) $val = $prop; // Callable function - execute to get the value - if (is_callable($prop) && is_object($prop)) { + if ($prop instanceof \Closure) { $val = $prop($db, $upload); } diff --git a/Ext.php b/Ext.php index ea846b2..013d7cc 100644 --- a/Ext.php +++ b/Ext.php @@ -107,8 +107,6 @@ protected function _getSet(&$prop, $val, $array = false) * @param array $data Data source array to read from * * @return bool true if present, false otherwise - * - * @private */ protected function _propExists($name, $data) { @@ -146,8 +144,6 @@ protected function _propExists($name, $data) * @param array $data Data source array to read from * * @return mixed The read value, or null if no value found. - * - * @private */ protected function _readProp($name, $data) { @@ -190,8 +186,6 @@ protected function _readProp($name, $data) * @param array &$out Array to write the data to * @param string $name Javascript dotted object name to write to * @param mixed $value Value to write - * - * @private */ protected function _writeProp(&$out, $name, $value) {