Procházet zdrojové kódy

Enforce type hints

Joanhey před 6 roky
rodič
revize
9c598b5a1c
2 změnil soubory, kde provedl 8 přidání a 6 odebrání
  1. 5 3
      Events/React/Base.php
  2. 3 3
      Lib/Timer.php

+ 5 - 3
Events/React/Base.php

@@ -12,14 +12,16 @@
  * @license   http://www.opensource.org/licenses/mit-license.php MIT License
  */
 namespace Workerman\Events\React;
+
 use Workerman\Events\EventInterface;
 use React\EventLoop\TimerInterface;
+use React\EventLoop\LoopInterface;
 
 /**
  * Class StreamSelectLoop
  * @package Workerman\Events\React
  */
-class Base implements \React\EventLoop\LoopInterface
+class Base implements LoopInterface
 {
     /**
      * @var array
@@ -37,7 +39,7 @@ class Base implements \React\EventLoop\LoopInterface
     protected $_signalHandlerMap = array();
 
     /**
-     * @var \React\EventLoop\LoopInterface
+     * @var LoopInterface
      */
     protected $_eventLoop = null;
 
@@ -58,7 +60,7 @@ class Base implements \React\EventLoop\LoopInterface
      * @param array $args
      * @return bool
      */
-    public function add($fd, $flag, $func, $args = array())
+    public function add($fd, $flag, $func, array $args = array())
     {
         $args = (array)$args;
         switch ($flag) {

+ 3 - 3
Lib/Timer.php

@@ -40,17 +40,17 @@ class Timer
     /**
      * event
      *
-     * @var \Workerman\Events\EventInterface
+     * @var EventInterface
      */
     protected static $_event = null;
 
     /**
      * Init.
      *
-     * @param \Workerman\Events\EventInterface $event
+     * @param EventInterface $event
      * @return void
      */
-    public static function init($event = null)
+    public static function init(EventInterface $event = null)
     {
         if ($event) {
             self::$_event = $event;