@@ -50,7 +50,7 @@ public function __construct($resource, LoopInterface $loop)
5050        // See https://bugs.php.net/bug.php?id=65137 
5151        // https://bugs.php.net/bug.php?id=41631 
5252        // https://github.com/reactphp/socket-client/issues/24 
53-         $ clearCompleteBuffer  = PHP_VERSION_ID  < 50608 ;
53+         $ clearCompleteBuffer  = \ PHP_VERSION_ID  < 50608 ;
5454
5555        // PHP < 7.1.4 (and PHP < 7.0.18) suffers from a bug when writing big 
5656        // chunks of data over TLS streams at once. 
@@ -60,7 +60,7 @@ public function __construct($resource, LoopInterface $loop)
6060        // affected versions. Please update your PHP version. 
6161        // This applies to all streams because TLS may be enabled later on. 
6262        // See https://github.com/reactphp/socket/issues/105 
63-         $ limitWriteChunks  = (PHP_VERSION_ID  < 70018  || (PHP_VERSION_ID  >= 70100  && PHP_VERSION_ID  < 70104 ));
63+         $ limitWriteChunks  = (\ PHP_VERSION_ID  < 70018  || (\ PHP_VERSION_ID  >= 70100  && \ PHP_VERSION_ID  < 70104 ));
6464
6565        $ this  ->input  = new  DuplexResourceStream (
6666            $ resource ,
@@ -120,7 +120,7 @@ public function close()
120120
121121    public  function  handleClose ()
122122    {
123-         if  (!is_resource ($ this  ->stream )) {
123+         if  (!\ is_resource ($ this  ->stream )) {
124124            return ;
125125        }
126126
@@ -130,18 +130,18 @@ public function handleClose()
130130        // continuing to close the socket resource. 
131131        // Underlying Stream implementation will take care of closing file 
132132        // handle, so we otherwise keep this open here. 
133-         @stream_socket_shutdown ($ this  ->stream , STREAM_SHUT_RDWR );
134-         stream_set_blocking ($ this  ->stream , false );
133+         @\ stream_socket_shutdown ($ this  ->stream , \ STREAM_SHUT_RDWR );
134+         \ stream_set_blocking ($ this  ->stream , false );
135135    }
136136
137137    public  function  getRemoteAddress ()
138138    {
139-         return  $ this  ->parseAddress (@stream_socket_get_name ($ this  ->stream , true ));
139+         return  $ this  ->parseAddress (@\ stream_socket_get_name ($ this  ->stream , true ));
140140    }
141141
142142    public  function  getLocalAddress ()
143143    {
144-         return  $ this  ->parseAddress (@stream_socket_get_name ($ this  ->stream , false ));
144+         return  $ this  ->parseAddress (@\ stream_socket_get_name ($ this  ->stream , false ));
145145    }
146146
147147    private  function  parseAddress ($ address )
@@ -153,8 +153,8 @@ private function parseAddress($address)
153153        if  ($ this  ->unix ) {
154154            // remove trailing colon from address for HHVM < 3.19: https://3v4l.org/5C1lo 
155155            // note that technically ":" is a valid address, so keep this in place otherwise 
156-             if  (substr ($ address , -1 ) === ': '  && defined ('HHVM_VERSION_ID ' ) && HHVM_VERSION_ID  < 31900 ) {
157-                 $ address  = (string )substr ($ address , 0 , -1 );
156+             if  (\ substr ($ address , -1 ) === ': '  && \ defined ('HHVM_VERSION_ID ' ) && \ HHVM_VERSION_ID  < 31900 ) {
157+                 $ address  = (string )\ substr ($ address , 0 , -1 );
158158            }
159159
160160            // work around unknown addresses should return null value: https://3v4l.org/5C1lo and https://bugs.php.net/bug.php?id=74556 
@@ -167,10 +167,10 @@ private function parseAddress($address)
167167        }
168168
169169        // check if this is an IPv6 address which includes multiple colons but no square brackets 
170-         $ pos  = strrpos ($ address , ': ' );
171-         if  ($ pos  !== false  && strpos ($ address , ': ' ) < $ pos  && substr ($ address , 0 , 1 ) !== '[ ' ) {
172-             $ port  = substr ($ address , $ pos  + 1 );
173-             $ address  = '[ '  . substr ($ address , 0 , $ pos ) . ']: '  . $ port ;
170+         $ pos  = \ strrpos ($ address , ': ' );
171+         if  ($ pos  !== false  && \ strpos ($ address , ': ' ) < $ pos  && \ substr ($ address , 0 , 1 ) !== '[ ' ) {
172+             $ port  = \ substr ($ address , $ pos  + 1 );
173+             $ address  = '[ '  . \ substr ($ address , 0 , $ pos ) . ']: '  . $ port ;
174174        }
175175
176176        return  ($ this  ->encryptionEnabled  ? 'tls '  : 'tcp ' ) . ':// '  . $ address ;
0 commit comments