Преглед изворни кода

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

Joanhey пре 6 година
родитељ
комит
0aa38df237
1 измењених фајлова са 4 додато и 4 уклоњено
  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'))