Explorar o código

Use const instead of define()
const are defined at compile time, define() at runtime

Joanhey %!s(int64=6) %!d(string=hai) anos
pai
achega
0aa38df237
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      Lib/Constants.php

+ 4 - 4
Lib/Constants.php

@@ -23,13 +23,13 @@ if (function_exists('opcache_reset')) {
 }
 
 // For onError callback.
-define('WORKERMAN_CONNECT_FAIL', 1);
+const WORKERMAN_CONNECT_FAIL = 1;
 // For onError callback.
-define('WORKERMAN_SEND_FAIL', 2);
+const WORKERMAN_SEND_FAIL = 2;
 
 // Define OS Type
-define('OS_TYPE_LINUX', 'linux');
-define('OS_TYPE_WINDOWS', 'windows');
+const OS_TYPE_LINUX = 'linux';
+const OS_TYPE_WINDOWS = 'windows';
 
 // Compatible with php7
 if(!class_exists('Error'))