From 94c876426fc2940d9ceef7603e30e6e22e53061d Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Mon, 7 Jul 2025 14:47:31 +0800 Subject: [PATCH] * [misc] compatibility with PHP8.4. --- framework/base/helper.class.php | 4 ++-- framework/base/router.class.php | 18 +++++++----------- framework/control.class.php | 8 +++++--- framework/helper.class.php | 2 +- framework/model.class.php | 2 ++ framework/router.class.php | 3 +++ lib/base/dao/dao.class.php | 2 +- lib/cache/cache.class.php | 9 +++++++++ lib/form/form.class.php | 4 ++-- lib/pinyin/pinyin.class.php | 7 +++++++ module/block/zen.php | 2 +- module/common/model.php | 12 ++++++------ module/dept/model.php | 2 +- module/execution/model.php | 16 ++++++++-------- module/kanban/model.php | 10 +++++----- module/my/model.php | 20 ++++++++++---------- module/my/tao.php | 10 +++++----- module/product/model.php | 10 +++++----- module/project/model.php | 4 ++-- module/user/model.php | 6 +++--- module/user/tao.php | 4 ++-- 21 files changed, 87 insertions(+), 68 deletions(-) diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 1ee249bb55..ad4944b59e 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -57,7 +57,7 @@ class baseHelper if(!is_object(${$objName}) or empty($key)) return false; $key = str_replace('.', '->', $key); $value = serialize($value); - $code = ("\$${objName}->{$key}=unserialize(<<{$key}=unserialize(<<config->debug)) error_reporting(E_ALL & ~ E_STRICT); + if(!empty($this->config->debug)) error_reporting(E_ALL); } /** @@ -1229,15 +1229,9 @@ class baseRouter if(is_writable($savePath)) { session_save_path($this->getTmpRoot() . 'session'); + $ztSessionHandler = new ztSessionHandler(); - session_set_save_handler( - array($ztSessionHandler, 'open'), - array($ztSessionHandler, 'close'), - array($ztSessionHandler, 'read'), - array($ztSessionHandler, 'write'), - array($ztSessionHandler, 'destroy'), - array($ztSessionHandler, 'gc') - ); + session_set_save_handler($ztSessionHandler, true); } } @@ -3359,7 +3353,7 @@ class baseRouter } /* Show non-serious errors to classic page. */ - if($level == E_NOTICE or $level == E_WARNING or $level == E_STRICT or $level == 8192) + if($level == E_NOTICE or $level == E_WARNING or $level == 8192) { $cmd = "vim +$line $file"; $size = strlen($cmd); @@ -3596,6 +3590,7 @@ else * * @package framework */ +#[AllowDynamicProperties] class language { /** @@ -3640,6 +3635,7 @@ class language * * @package framework */ +#[AllowDynamicProperties] class super { /** @@ -3811,7 +3807,7 @@ class EndResponseException extends \Exception * * @package framework */ -class ztSessionHandler +class ztSessionHandler implements SessionHandlerInterface { public $sessSavePath; public $sessionFile; diff --git a/framework/control.class.php b/framework/control.class.php index 648b4f68e5..9419a028b0 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -18,6 +18,8 @@ * @package framework */ include __DIR__ . '/base/control.class.php'; + +#[AllowDynamicProperties] class control extends baseControl { /** @@ -515,7 +517,7 @@ class control extends baseControl * @access public * @return zin\fieldList */ - public function appendExtendFields(zin\fieldList $fields, string $moduleName = '', string $methodName = '', object $object = null): zin\fieldList + public function appendExtendFields(zin\fieldList $fields, string $moduleName = '', string $methodName = '', ?object $object = null): zin\fieldList { if($this->config->edition == 'open') return $fields; if(!empty($this->app->installing) || !empty($this->app->upgrading)) return $fields; @@ -557,7 +559,7 @@ class control extends baseControl * @access public * @return string */ - public function appendExtendCssAndJS(string $moduleName = '', string $methodName = '', object $object = null): string + public function appendExtendCssAndJS(string $moduleName = '', string $methodName = '', ?object $object = null): string { if($this->config->edition == 'open') return ''; if(!empty($this->app->installing) || !empty($this->app->upgrading)) return ''; @@ -598,7 +600,7 @@ class control extends baseControl * @access public * @return array */ - public function appendExtendForm(string $position = 'info', object $object = null, string $moduleName = '', string $methodName = ''): array + public function appendExtendForm(string $position = 'info', ?object $object = null, string $moduleName = '', string $methodName = ''): array { if($this->config->edition == 'open') return array(); if(!empty($this->app->installing) || !empty($this->app->upgrading)) return array(); diff --git a/framework/helper.class.php b/framework/helper.class.php index 3bfb7dacd6..8075e939b9 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -509,7 +509,7 @@ function initPageEntity(object $object): array * @access public * @return array */ -function initTableData(array $items, array &$fieldList, object $model = null, string $moduleName = ''): array +function initTableData(array $items, array &$fieldList, ?object $model = null, string $moduleName = ''): array { if(!empty($_GET['orderBy']) && strpos($_GET['orderBy'], '-') !== false) list($orderField, $orderValue) = explode('_', $_GET['orderBy']); if(!empty($orderField) && !empty($orderValue) && !empty($fieldList[$orderField])) diff --git a/framework/model.class.php b/framework/model.class.php index d0a24cab3d..0bcbd659ce 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -18,6 +18,8 @@ * @package framework */ include __DIR__ . '/base/model.class.php'; + +#[AllowDynamicProperties] class model extends baseModel { /** diff --git a/framework/router.class.php b/framework/router.class.php index d0666cc59f..daa292f9bd 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -18,6 +18,9 @@ * @package framework */ include __DIR__ . '/base/router.class.php'; + + +#[AllowDynamicProperties] class router extends baseRouter { /** diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index a3d1c5c11f..1ed564cd6a 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -441,7 +441,7 @@ class baseDAO * @access public * @return void */ - public function setCache($key, $sql = '', $value = null, int $ttl = null) + public function setCache($key, $sql = '', $value = null, ?int $ttl = null) { if(!$this->app->isServing() || empty($this->cache)) return false; diff --git a/lib/cache/cache.class.php b/lib/cache/cache.class.php index dc0f657cea..5a4acb082b 100644 --- a/lib/cache/cache.class.php +++ b/lib/cache/cache.class.php @@ -50,6 +50,15 @@ class cache */ private $dao; + /** + * 全局数据库操作句柄。 + * Global database operation handler. + * + * @access private + * @var object + */ + private $dbh; + /** * 全局配置对象。 * Global configuration object. diff --git a/lib/form/form.class.php b/lib/form/form.class.php index 921d431336..43ee193da4 100644 --- a/lib/form/form.class.php +++ b/lib/form/form.class.php @@ -68,7 +68,7 @@ class form extends fixer * @param int $objectID * @return form */ - public static function data(array $configObject = null, int $objectID = 0): form + public static function data(?array $configObject = null, int $objectID = 0): form { global $app, $config; @@ -85,7 +85,7 @@ class form extends fixer * @param array|null $configObject * @return form */ - public static function batchData(array $configObject = null): form + public static function batchData(?array $configObject = null): form { global $app, $config; diff --git a/lib/pinyin/pinyin.class.php b/lib/pinyin/pinyin.class.php index 308a831695..60469dc516 100644 --- a/lib/pinyin/pinyin.class.php +++ b/lib/pinyin/pinyin.class.php @@ -7,6 +7,13 @@ */ class pinyin { + /** + * Segments. + * @var array + * + */ + protected array $segments = array(); + /** * Constructor. * diff --git a/module/block/zen.php b/module/block/zen.php index 9dd280fdad..4e698bb911 100644 --- a/module/block/zen.php +++ b/module/block/zen.php @@ -3499,7 +3499,7 @@ class blockZen extends block * @access protected * @return object */ - protected function buildProjectStatistic(object $project, array $data, object $pager = null): object + protected function buildProjectStatistic(object $project, array $data, ?object $pager = null): object { extract($data); $projectID = $project->id; diff --git a/module/common/model.php b/module/common/model.php index ec6015c06b..8134c12232 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1303,7 +1303,7 @@ eof; * @access public * @return bool */ - public static function hasPriv(string $module, string $method, mixed $object = null, string $vars = '') + public static function hasPriv(string $module, string $method, $object = null, string $vars = '') { /* If the user is doing a tutorial, have all privileges. */ if(commonModel::isTutorialMode()) return true; @@ -1347,7 +1347,7 @@ eof; * @access public * @return bool */ - public static function getUserPriv(string $module, string $method, mixed $object = null, string $vars = ''): bool + public static function getUserPriv(string $module, string $method, $object = null, string $vars = ''): bool { global $app,$config; $module = strtolower($module); @@ -1846,7 +1846,7 @@ eof; * @access public * @return bool */ - public static function canBeChanged(string $module, mixed $object = null): bool + public static function canBeChanged(string $module, $object = null): bool { if(defined('RUN_MODE') && RUN_MODE == 'api') return true; @@ -1980,7 +1980,7 @@ eof; * @access public * @return string|array|bool */ - public static function http(string $url, string|array|object|null $data = null, array $options = array(), array $headers = array(), string $dataType = 'data', string $method = 'POST', int $timeout = 30, bool $httpCode = false, bool $log = true): string|array|bool + public static function http(string $url, $data = null, array $options = array(), array $headers = array(), string $dataType = 'data', string $method = 'POST', int $timeout = 30, bool $httpCode = false, bool $log = true): string|array|bool { global $lang, $app; @@ -2469,7 +2469,7 @@ eof; * @access public * @return void */ - public static function buildActionItem(string $module, string $method, string $params, object|null $object = null, array $attrs = array()): array + public static function buildActionItem(string $module, string $method, string $params, ?object $object = null, array $attrs = array()): array { if(!commonModel::hasPriv($module, $method, $object)) return array(); @@ -3819,7 +3819,7 @@ eof; * @access public * @return mixed */ - public static function printCommentIcon(string $commentFormLink, object $object = null) + public static function printCommentIcon(string $commentFormLink, ?object $object = null) { global $lang; diff --git a/module/dept/model.php b/module/dept/model.php index efa0ba2baf..7d39627ec8 100644 --- a/module/dept/model.php +++ b/module/dept/model.php @@ -335,7 +335,7 @@ class deptModel extends model * @access public * @return array */ - public function getUsers(string $browseType = 'inside', array $depts = array(), string $orderBy = 'id', object $pager = null): array + public function getUsers(string $browseType = 'inside', array $depts = array(), string $orderBy = 'id', ?object $pager = null): array { return $this->dao->select('*')->from(TABLE_USER) ->where('deleted')->eq(0) diff --git a/module/execution/model.php b/module/execution/model.php index 3224289d71..54471415ba 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1051,7 +1051,7 @@ class executionModel extends model * @access public * @return bool */ - public function checkWorkload(string $type = '', float $percent = 0, object $oldExecution = null): bool + public function checkWorkload(string $type = '', float $percent = 0, ?object $oldExecution = null): bool { /* Check whether the workload is positive. */ if(!preg_match("/^[0-9]+(.[0-9]{1,3})?$/", (string)$percent)) @@ -1230,7 +1230,7 @@ class executionModel extends model * @access public * @return array */ - public function getList(int $projectID = 0, string $type = 'all',string $status = 'all', int $limit = 0, int $productID = 0, int $branch = 0, object|null $pager = null, bool $withChildren = true) + public function getList(int $projectID = 0, string $type = 'all',string $status = 'all', int $limit = 0, int $productID = 0, int $branch = 0, ?object $pager = null, bool $withChildren = true) { if(common::isTutorialMode()) return $this->loadModel('tutorial')->getExecutionStats($type); @@ -1400,7 +1400,7 @@ class executionModel extends model * @access public * @return array */ - public function getStatData(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $branch = 0, bool $withTasks = false, string|int $param = '', string $orderBy = 'id_asc', object|null $pager = null): array + public function getStatData(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $branch = 0, bool $withTasks = false, string|int $param = '', string $orderBy = 'id_asc', ?object $pager = null): array { if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getExecutionStats($browseType); @@ -1501,7 +1501,7 @@ class executionModel extends model * @access public * @return array */ - public function fetchExecutionList(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $param = 0, string $orderBy = 'id_asc', object|null $pager = null): array + public function fetchExecutionList(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $param = 0, string $orderBy = 'id_asc', ?object $pager = null): array { /* Construct the query SQL at search executions. */ $executionQuery = $browseType == 'bySearch' ? $this->getExecutionQuery($param) : ''; @@ -1973,7 +1973,7 @@ class executionModel extends model * @access public * @return array */ - public function getTasks(int $productID, int|array $executionID, array $executions, string $browseType, int $queryID, int $moduleID, string $sort, object $pager = null): array + public function getTasks(int $productID, int|array $executionID, array $executions, string $browseType, int $queryID, int $moduleID, string $sort, ?object $pager = null): array { if(common::isTutorialMode()) return $this->loadModel('tutorial')->getTasks(); @@ -2279,7 +2279,7 @@ class executionModel extends model * @access public * @return void */ - public function buildStorySearchForm(array $products, array $branchGroups, array $modules, int $queryID, string $actionURL, string $type = 'executionStory', object $execution = null): void + public function buildStorySearchForm(array $products, array $branchGroups, array $modules, int $queryID, string $actionURL, string $type = 'executionStory', ?object $execution = null): void { $this->loadModel('productplan'); $this->app->loadLang('branch'); @@ -3763,7 +3763,7 @@ class executionModel extends model * @access public * @return array */ - public function getSearchTasks(string $condition, string $orderBy, object $pager = null, string $queryKey = 'task'): array + public function getSearchTasks(string $condition, string $orderBy, ?object $pager = null, string $queryKey = 'task'): array { /* 按指派人搜索的时候,可以搜索到参与的多人任务。 */ if(strpos($condition, '`assignedTo`') !== false) @@ -4209,7 +4209,7 @@ class executionModel extends model * @access public * @return array */ - public function getKanbanTasks(int $executionID, string $orderBy = 'status_asc, id_desc', array $excludeTasks = array(), object|null $pager = null): array + public function getKanbanTasks(int $executionID, string $orderBy = 'status_asc, id_desc', array $excludeTasks = array(), ?object $pager = null): array { $excludeTasks = array_filter($excludeTasks); $tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName') diff --git a/module/kanban/model.php b/module/kanban/model.php index 4b60b5bff3..b4f3349efb 100755 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -104,7 +104,7 @@ class kanbanModel extends model * @access public * @return int */ - public function createRegion(object $kanban, object $fromRegion = null, int $copyRegionID = 0, string $from = 'kanban', string $param = '') + public function createRegion(object $kanban, ?object $fromRegion = null, int $copyRegionID = 0, string $from = 'kanban', string $param = '') { $account = $this->app->user->account; $order = 1; @@ -355,7 +355,7 @@ class kanbanModel extends model * @access public * @return int|false */ - public function createColumn(int $regionID, object $column = null, string $from = 'kanban', string $mode = 'new'): int|false + public function createColumn(int $regionID, ?object $column = null, string $from = 'kanban', string $mode = 'new'): int|false { if($mode == 'new') { @@ -1865,7 +1865,7 @@ class kanbanModel extends model * @access public * @return array */ - public function getSpaceList(string $browseType, object $pager = null): array + public function getSpaceList(string $browseType, ?object $pager = null): array { $account = $this->app->user->account; $spaceIdList = $this->getCanViewObjects('kanbanspace', $browseType); @@ -2155,7 +2155,7 @@ class kanbanModel extends model * @access public * @return int|bool */ - public function createLane(int $kanbanID, int $regionID, object $lane = null, string $mode = 'new'): int|bool + public function createLane(int $kanbanID, int $regionID, ?object $lane = null, string $mode = 'new'): int|bool { $laneType = isset($_POST['laneType']) ? $_POST['laneType'] : 'common'; if($laneType == 'common') @@ -3665,7 +3665,7 @@ class kanbanModel extends model * @access public * @return array */ - public function getCards2Import(int $kanbanID = 0, int $excludedID = 0, object $pager = null): array + public function getCards2Import(int $kanbanID = 0, int $excludedID = 0, ?object $pager = null): array { $kanbanIdList = $this->getCanViewObjects(); diff --git a/module/my/model.php b/module/my/model.php index 016557e161..bdb518f9e6 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -262,7 +262,7 @@ class myModel extends model * @access public * @return array */ - public function getAssignedByMe(string $account, object $pager = null, string $orderBy = 'id_desc', string $objectType = ''): array + public function getAssignedByMe(string $account, ?object $pager = null, string $orderBy = 'id_desc', string $objectType = ''): array { $module = $objectType == 'requirement' ? 'story' : $objectType; $objectIdList = $this->dao->select('objectID')->from(TABLE_ACTION) @@ -315,7 +315,7 @@ class myModel extends model * @access private * @return array */ - private function getTaskAssignedByMe(object $pager = null, string $orderBy = 'id_desc', array $objectIdList = array()): array + private function getTaskAssignedByMe(?object $pager = null, string $orderBy = 'id_desc', array $objectIdList = array()): array { // 处理优先级排序 if(strpos($orderBy, 'pri_') !== false) $orderBy = str_replace('pri_', 'priOrder_', $orderBy); @@ -391,7 +391,7 @@ class myModel extends model * @access public * @return array */ - public function getTestcasesBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array + public function getTestcasesBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array { $queryName = $type == 'contribute' ? 'contributeTestcaseQuery' : 'workTestcaseQuery'; $queryForm = $type == 'openedbyme' ? 'contributeTestcaseForm' : 'workTestcaseForm'; @@ -494,7 +494,7 @@ class myModel extends model * @access public * @return array */ - public function getTasksBySearch(string $account, int $limit = 0, object $pager = null, string $orderBy = 'id_desc', int $queryID = 0): array + public function getTasksBySearch(string $account, int $limit = 0, ?object $pager = null, string $orderBy = 'id_desc', int $queryID = 0): array { $moduleName = $this->app->rawMethod == 'work' ? 'workTask' : 'contributeTask'; $queryName = $moduleName . 'Query'; @@ -619,7 +619,7 @@ class myModel extends model * @access public * @return array */ - public function getRisksBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array + public function getRisksBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array { $queryName = $type == 'contribute' ? 'contributeRiskQuery' : 'workRiskQuery'; if($queryID && $queryID != 'myQueryID') @@ -715,7 +715,7 @@ class myModel extends model * @access public * @return array */ - public function getStoriesBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array + public function getStoriesBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array { $queryName = $type == 'contribute' ? 'contributeStoryQuery' : 'workStoryQuery'; $queryForm = $type == 'contribute' ? 'contributeStoryForm' : 'workStoryForm'; @@ -865,7 +865,7 @@ class myModel extends model * @access public * @return array */ - public function getEpicsBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array + public function getEpicsBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array { $queryName = $type == 'contribute' ? 'contributeEpicQuery' : 'workEpicQuery'; $queryForm = $type == 'contribute' ? 'contributeEpicForm' : 'workEpicForm'; @@ -907,7 +907,7 @@ class myModel extends model * @access public * @return array */ - public function getRequirementsBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array + public function getRequirementsBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array { $queryName = $type == 'contribute' ? 'contributeRequirementQuery' : 'workRequirementQuery'; $queryForm = $type == 'contribute' ? 'contributeRequirementForm' : 'workRequirementForm'; @@ -981,7 +981,7 @@ class myModel extends model * @access public * @return array */ - public function getReviewingList(string $browseType, string $orderBy = 'time_desc', object $pager = null): array + public function getReviewingList(string $browseType, string $orderBy = 'time_desc', ?object $pager = null): array { $vision = $this->config->vision; $reviewList = array(); @@ -1370,7 +1370,7 @@ class myModel extends model * @access public * @return array */ - public function getReviewedList(string $browseType, string $orderBy = 'time_desc', object $pager = null): array + public function getReviewedList(string $browseType, string $orderBy = 'time_desc', ?object $pager = null): array { $field = $orderBy; $direction = 'asc'; diff --git a/module/my/tao.php b/module/my/tao.php index 8161a1aaa2..ea78598d66 100644 --- a/module/my/tao.php +++ b/module/my/tao.php @@ -23,7 +23,7 @@ class myTao extends myModel * @access protected * @return array */ - protected function getProductRelatedAssignedByMe(array $objectIdList, string $objectType, string $module, string $orderBy, object $pager = null): array + protected function getProductRelatedAssignedByMe(array $objectIdList, string $objectType, string $module, string $orderBy, ?object $pager = null): array { $nameField = $objectType == 'bug' ? 'productName' : 'productTitle'; $orderBy = strpos($orderBy, 'priOrder') !== false || strpos($orderBy, 'severityOrder') !== false || strpos($orderBy, $nameField) !== false ? $orderBy : "t1.{$orderBy}"; @@ -63,7 +63,7 @@ class myTao extends myModel * @access protected * @return array */ - protected function fetchTasksBySearch(string $query, string $moduleName, string $account, array $taskIdList, string $orderBy, int $limit, object $pager = null): array + protected function fetchTasksBySearch(string $query, string $moduleName, string $account, array $taskIdList, string $orderBy, int $limit, ?object $pager = null): array { $query = preg_replace('/`(\w+)`/', 't1.`$1`', $query); $query = str_replace('t1.`project`', 't2.`project`', $query); @@ -133,7 +133,7 @@ class myTao extends myModel * @access protected * @return array */ - protected function fetchStoriesBySearch(string $myStoryQuery, string $type, string $orderBy, object $pager = null, array $storiesAssignedByMe = array()): array + protected function fetchStoriesBySearch(string $myStoryQuery, string $type, string $orderBy, ?object $pager = null, array $storiesAssignedByMe = array()): array { if($type == 'contribute') { @@ -188,7 +188,7 @@ class myTao extends myModel * @access protected * @return array */ - protected function fetchEpicsBySearch(string $myEpicQuery, string $type, string $orderBy, object $pager = null, array $epicIDList = array()): array + protected function fetchEpicsBySearch(string $myEpicQuery, string $type, string $orderBy, ?object $pager = null, array $epicIDList = array()): array { if($type == 'contribute') { @@ -245,7 +245,7 @@ class myTao extends myModel * @access protected * @return array */ - protected function fetchRequirementsBySearch(string $myRequirementQuery, string $type, string $orderBy, object $pager = null, array $requirementIDList = array()): array + protected function fetchRequirementsBySearch(string $myRequirementQuery, string $type, string $orderBy, ?object $pager = null, array $requirementIDList = array()): array { if($type == 'contribute') { diff --git a/module/product/model.php b/module/product/model.php index fc65cee63c..c0403ae487 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -651,7 +651,7 @@ class productModel extends model * @access public * @return array */ - public function getStories(int|array $productID, string $branch, string $browseType, int $queryID, int $moduleID, string $type = 'story', string $sort = 'id_desc', object|null$pager = null): array + public function getStories(int|array $productID, string $branch, string $browseType, int $queryID, int $moduleID, string $type = 'story', string $sort = 'id_desc', ?object $pager = null): array { if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getStories(); @@ -909,7 +909,7 @@ class productModel extends model * @access public * @return array */ - public function getProjectListByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', object|null $pager = null): array + public function getProjectListByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', ?object $pager = null): array { $branch = $branch ? $branch : '0'; if(!$involved) $projectList = $this->productTao->fetchAllProductProjects($productID, $browseType, $branch, $orderBy, $pager); @@ -939,7 +939,7 @@ class productModel extends model * @access public * @return int[] */ - public function getProjectStatsByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', object|null $pager = null): array + public function getProjectStatsByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', ?object $pager = null): array { $projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy, $pager); if(empty($projects)) return array(); @@ -1103,7 +1103,7 @@ class productModel extends model * @access public * @return array */ - public function getStats(array $productIdList, string $orderBy = 'order_asc', object|null $pager = null, string $storyType = 'story', int $programID = 0): array + public function getStats(array $productIdList, string $orderBy = 'order_asc', ?object $pager = null, string $storyType = 'story', int $programID = 0): array { /* Call the getProductStats method of the tutorial module if you are in tutorial mode.*/ if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getProductStats(); @@ -1673,7 +1673,7 @@ class productModel extends model * @access public * @return array */ - public function getStatsProducts(array $productIdList, bool $appendProgram, string $orderBy, object|null $pager = null): array + public function getStatsProducts(array $productIdList, bool $appendProgram, string $orderBy, ?object $pager = null): array { if($orderBy == 'program_asc') { diff --git a/module/project/model.php b/module/project/model.php index e7e8dfc0de..46b52e70fd 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -336,7 +336,7 @@ class projectModel extends model * @access public * @return array */ - public function getList(string $status = 'undone', string $orderBy = 'order_desc', bool $involved = false, object|null $pager = null): array + public function getList(string $status = 'undone', string $orderBy = 'order_desc', bool $involved = false, ?object $pager = null): array { /* Get project list by status. */ $projects = $this->projectTao->fetchProjectList($status, $orderBy, $involved, $pager); @@ -1463,7 +1463,7 @@ class projectModel extends model * @access public * @return array|false */ - public function update(object $project, object $oldProject, object $postProductData = null): array|false + public function update(object $project, object $oldProject, ?object $postProductData = null): array|false { /* 通过主键查老项目信息, 处理父节点和图片字段。*/ /* Fetch old project's info and dispose parent and file info. */ diff --git a/module/user/model.php b/module/user/model.php index cba2cac97b..caa4e2f647 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -464,7 +464,7 @@ class userModel extends model * @access public * @return array */ - public function getByQuery(string $browseType = 'inside', string $query = '', object $pager = null, string $orderBy = 'id'): array + public function getByQuery(string $browseType = 'inside', string $query = '', ?object $pager = null, string $orderBy = 'id'): array { return $this->dao->select('*')->from(TABLE_USER) ->where('deleted')->eq('0') @@ -1296,7 +1296,7 @@ class userModel extends model * @access public * @return array */ - public function getProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array + public function getProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array { $this->loadModel('project'); $projects = $this->userTao->fetchProjects($account, $status, $orderBy, $pager); @@ -1336,7 +1336,7 @@ class userModel extends model * @access public * @return array */ - public function getExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array + public function getExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array { $executions = $this->userTao->fetchExecutions($account, $status, $orderBy, $pager); if(!$executions) return array(); diff --git a/module/user/tao.php b/module/user/tao.php index 3dcd8e28cc..1eac761d7b 100644 --- a/module/user/tao.php +++ b/module/user/tao.php @@ -22,7 +22,7 @@ class userTao extends userModel * @access public * @return array */ - public function fetchProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array + public function fetchProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array { return $this->dao->select('t1.role, t1.join, t1.days, t1.hours, t2.*')->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id') @@ -97,7 +97,7 @@ class userTao extends userModel * @access public * @return array */ - public function fetchExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array + public function fetchExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array { return $this->dao->select('t1.role, t1.join, t1.days, t1.hours, t2.*')->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')