Bläddra i källkod

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

Joanhey 6 år sedan
förälder
incheckning
0aa38df237
1 ändrade filer med 4 tillägg och 4 borttagningar
  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'))