Переглянути джерело

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'))