Fix thrift includes

Summary: Remove circular ref

Reviewed By: lucas


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665019 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/src/Thrift.php b/lib/php/src/Thrift.php
index 87bcc2b..ab56eff 100644
--- a/lib/php/src/Thrift.php
+++ b/lib/php/src/Thrift.php
@@ -1,12 +1,35 @@
 <?php
 
 /**
- * Set global THRIFT ROOT automatically via inclusion here
+ * Data types that can be sent via Thrift
  */
-if (!isset($GLOBALS['THRIFT_ROOT'])) {
-  $GLOBALS['THRIFT_ROOT'] = dirname(__FILE__);
+class TType {
+  const STOP   = 0;
+  const VOID   = 1;
+  const BOOL   = 2;
+  const BYTE   = 3;
+  const I08    = 3;
+  const DOUBLE = 4;
+  const I16    = 6;
+  const I32    = 8;
+  const I64    = 10;
+  const STRING = 11;
+  const UTF7   = 11;
+  const STRUCT = 12;
+  const MAP    = 13;
+  const SET    = 14;
+  const LST    = 15;    // N.B. cannot use LIST keyword in PHP!
+  const UTF8   = 16;
+  const UTF16  = 17;
 }
-include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TProtocol.php';
+
+/**
+ * Message types for RPC
+ */
+class TMessageType {
+  const CALL  = 1;
+  const REPLY = 2;
+}
 
 class TException extends Exception {
   function __construct($message=null, $code=0) {
@@ -84,5 +107,13 @@
   }
 }
 
+/**
+ * Set global THRIFT ROOT automatically via inclusion here
+ */
+if (!isset($GLOBALS['THRIFT_ROOT'])) {
+  $GLOBALS['THRIFT_ROOT'] = dirname(__FILE__);
+}
+include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TProtocol.php';
+include_once $GLOBALS['THRIFT_ROOT'].'/transport/TTransport.php';
 
 ?>
diff --git a/lib/php/src/protocol/TBinaryProtocol.php b/lib/php/src/protocol/TBinaryProtocol.php
index e9ea3b8..91fcd5f 100644
--- a/lib/php/src/protocol/TBinaryProtocol.php
+++ b/lib/php/src/protocol/TBinaryProtocol.php
@@ -1,8 +1,5 @@
 <?php 
 
-/** For transport operations */
-include_once $GLOBALS['THRIFT_ROOT'].'/transport/TTransport.php';
-
 /**
  * Binary implementation of the Thrift protocol.
  *
diff --git a/lib/php/src/protocol/TProtocol.php b/lib/php/src/protocol/TProtocol.php
index d95c26c..63e9308 100644
--- a/lib/php/src/protocol/TProtocol.php
+++ b/lib/php/src/protocol/TProtocol.php
@@ -9,39 +9,6 @@
  * @author Aditya Agarwal <aditya@facebook.com>
  */
 
-include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
-
-/**
- * Data types that can be sent via Thrift
- */
-class TType {
-  const STOP   = 0;
-  const VOID   = 1;
-  const BOOL   = 2;
-  const BYTE   = 3;
-  const I08    = 3;
-  const DOUBLE = 4;
-  const I16    = 6;
-  const I32    = 8;
-  const I64    = 10;
-  const STRING = 11;
-  const UTF7   = 11;
-  const STRUCT = 12;
-  const MAP    = 13;
-  const SET    = 14;
-  const LST    = 15;    // N.B. cannot use LIST keyword in PHP!
-  const UTF8   = 16;
-  const UTF16  = 17;
-}
-
-/**
- * Message types for RPC
- */
-class TMessageType {
-  const CALL  = 1;
-  const REPLY = 2;
-}
-
 /**
  * Protocol exceptions
  */