Jelajahi Sumber

Fixed : php8 warning

朱金辉 6 hari lalu
induk
melakukan
0fb081d490
3 mengubah file dengan 13 tambahan dan 7 penghapusan
  1. 2 1
      src/Base/Request.php
  2. 5 0
      src/Driver/ConnBase.php
  3. 6 6
      src/Driver/Entity/Entity.php

+ 2 - 1
src/Base/Request.php

@@ -639,7 +639,8 @@ abstract class Request
 
             do {
                 if ($scriptFileName && is_string($scriptFileName)) {
-                    $fileName = basename($scriptFileName, \Qii::getInstance()->appConfigure('ext', '.php'));
+                    $suffer = (string) \Qii::getInstance()->appConfigure('ext', '.php');
+                    $fileName = basename($scriptFileName, $suffer);
                     $fileNameLen = strlen($fileName);
 
                     $scriptName = $this->getServer('SCRIPT_NAME');

+ 5 - 0
src/Driver/ConnBase.php

@@ -20,6 +20,11 @@ class ConnBase
     protected $_dbInfo;
 
     /**
+     * @var array $_connections 数据库链接
+     */
+    protected $_connections;
+
+    /**
      * @var resource $_writeConnection  获取写的链接
      */
     protected static $_writeConnection = null;

+ 6 - 6
src/Driver/Entity/Entity.php

@@ -86,28 +86,28 @@ class Entity {
             $comment = strlen($comment) > 0 ? " ". $comment : "";
 
             $doc = [];
-            if(($tableInfo['rules']['int'] && isset($tableInfo['rules']['int'][$field])) ||
-                ($tableInfo['rules']['number'] && isset($tableInfo['rules']['number'][$field]))
+            if(isset($tableInfo['rules']['int'][$field]) ||
+                isset($tableInfo['rules']['number'][$field])
             ) {
                 $doc[] = "\t/**";
                 $doc[] = "\t * @var int ". $convertField . $comment;
                 $doc[] = "\t */";
-            } else if (($tableInfo['rules']['maxlength'] && isset($tableInfo['rules']['maxlength'][$field]))
+            } else if (isset($tableInfo['rules']['maxlength'][$field])
                 || (isset($tableInfo['rules']['text']) && in_array($field, $tableInfo['rules']['text']))
             ) {
                 $doc[] = "\t/**";
                 $doc[] = "\t * @var string ". $convertField . $comment;
                 $doc[] = "\t */";
-            } else if ($tableInfo['rules']['timestamp'] && in_array($field, $tableInfo['rules']['timestamp'])) {
+            } else if (isset($tableInfo['rules']['timestamp']) && in_array($field, $tableInfo['rules']['timestamp'])) {
                 $doc[] = "\t/**";
                 $doc[] = "\t * @var datetime ". $convertField . $comment;
                 $doc[] = "\t */";
-            } else if($tableInfo['rules']['float'] && isset($tableInfo['rules']['float'][$field])) {
+            } else if(isset($tableInfo['rules']['float'][$field])) {
                 $doc[] = "\t/**";
                 $doc[] = "\t * @var float ". $convertField . $comment;
                 $doc[] = "\t */";
             }
-            if($tableInfo['rules']['default'] && isset($tableInfo['rules']['default'][$field])) {
+            if(isset($tableInfo['rules']['default'][$field])) {
                 $default = $tableInfo['rules']['default'][$field];
                 $defaults[$convertField] = $default;
             }