浏览代码

兼容php7和php8

xaboy 1 年之前
父节点
当前提交
85d6a099e5
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 1 1
      composer.json
  2. 5 5
      src/Driver/CustomComponent.php

+ 1 - 1
composer.json

@@ -27,7 +27,7 @@
     "source": "https://github.com/xaboy/form-builder"
     "source": "https://github.com/xaboy/form-builder"
   },
   },
   "require": {
   "require": {
-    "php": ">=5.4.0",
+    "php": ">=7.1",
     "ext-json": "*",
     "ext-json": "*",
     "symfony/http-foundation": ">=2.6",
     "symfony/http-foundation": ">=2.6",
     "doctrine/annotations": "^1.2.7"
     "doctrine/annotations": "^1.2.7"

+ 5 - 5
src/Driver/CustomComponent.php

@@ -94,27 +94,27 @@ class CustomComponent implements CustomComponentInterface, \JsonSerializable, \A
         return $this->appendRule + $this->getRule();
         return $this->appendRule + $this->getRule();
     }
     }
 
 
-    public function jsonSerialize()
+    public function jsonSerialize(): mixed
     {
     {
         return $this->build();
         return $this->build();
     }
     }
 
 
-    public function offsetExists($offset)
+    public function offsetExists($offset): bool
     {
     {
         return isset($this->props[$offset]);
         return isset($this->props[$offset]);
     }
     }
 
 
-    public function offsetGet($offset)
+    public function offsetGet($offset): mixed
     {
     {
         return $this->props[$offset];
         return $this->props[$offset];
     }
     }
 
 
-    public function offsetSet($offset, $value)
+    public function offsetSet($offset, $value): void
     {
     {
         $this->props[$offset] = $value;
         $this->props[$offset] = $value;
     }
     }
 
 
-    public function offsetUnset($offset)
+    public function offsetUnset($offset): void
     {
     {
         unset($this->props[$offset]);
         unset($this->props[$offset]);
     }
     }