THRIFT-4477: php TBufferedTransport must have underlying transport
Client: php

This closes #1484
diff --git a/lib/php/lib/Factory/TStringFuncFactory.php b/lib/php/lib/Factory/TStringFuncFactory.php
index 7739d16..30de4d7 100644
--- a/lib/php/lib/Factory/TStringFuncFactory.php
+++ b/lib/php/lib/Factory/TStringFuncFactory.php
@@ -21,8 +21,9 @@
 
 namespace Thrift\Factory;
 
-use Thrift\StringFunc\Mbstring;
 use Thrift\StringFunc\Core;
+use Thrift\StringFunc\Mbstring;
+use Thrift\StringFunc\TStringFunc;
 
 class TStringFuncFactory
 {
@@ -49,7 +50,7 @@
          * Cannot use str* functions for byte counting because multibyte
          * characters will be read a single bytes.
          *
-         * See: http://us.php.net/manual/en/mbstring.overload.php
+         * See: http://php.net/manual/en/mbstring.overload.php
          */
         if (ini_get('mbstring.func_overload') & 2) {
             self::$_instance = new Mbstring();
diff --git a/lib/php/lib/Transport/TBufferedTransport.php b/lib/php/lib/Transport/TBufferedTransport.php
index a541cbb..253c5ac 100644
--- a/lib/php/lib/Transport/TBufferedTransport.php
+++ b/lib/php/lib/Transport/TBufferedTransport.php
@@ -22,6 +22,7 @@
 
 namespace Thrift\Transport;
 
+use Thrift\Exception\TTransportException;
 use Thrift\Factory\TStringFuncFactory;
 
 /**
@@ -34,21 +35,11 @@
 class TBufferedTransport extends TTransport
 {
     /**
-     * Constructor. Creates a buffered transport around an underlying transport
-     */
-    public function __construct($transport = null, $rBufSize = 512, $wBufSize = 512)
-    {
-        $this->transport_ = $transport;
-        $this->rBufSize_ = $rBufSize;
-        $this->wBufSize_ = $wBufSize;
-    }
-
-    /**
      * The underlying transport
      *
      * @var TTransport
      */
-    protected $transport_ = null;
+    protected $transport_;
 
     /**
      * The receive buffer size
@@ -78,11 +69,26 @@
      */
     protected $rBuf_ = '';
 
+    /**
+     * Constructor. Creates a buffered transport around an underlying transport
+     */
+    public function __construct($transport, $rBufSize = 512, $wBufSize = 512)
+    {
+        $this->transport_ = $transport;
+        $this->rBufSize_ = $rBufSize;
+        $this->wBufSize_ = $wBufSize;
+    }
+
     public function isOpen()
     {
         return $this->transport_->isOpen();
     }
 
+    /**
+     * @inheritdoc
+     *
+     * @throws TTransportException
+     */
     public function open()
     {
         $this->transport_->open();
@@ -110,6 +116,8 @@
      *
      * Therefore, use the readAll method of the wrapped transport inside
      * the buffered readAll.
+     *
+     * @throws TTransportException
      */
     public function readAll($len)
     {
@@ -131,6 +139,13 @@
         return $data;
     }
 
+    /**
+     * @inheritdoc
+     *
+     * @param int $len
+     * @return string
+     * @throws TTransportException
+     */
     public function read($len)
     {
         if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {
@@ -150,6 +165,12 @@
         return $ret;
     }
 
+    /**
+     * @inheritdoc
+     *
+     * @param string $buf
+     * @throws TTransportException
+     */
     public function write($buf)
     {
         $this->wBuf_ .= $buf;
@@ -164,6 +185,11 @@
         }
     }
 
+    /**
+     * @inheritdoc
+     *
+     * @throws TTransportException
+     */
     public function flush()
     {
         if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {
diff --git a/lib/php/lib/Transport/TTransport.php b/lib/php/lib/Transport/TTransport.php
index df248f2..35921c6 100644
--- a/lib/php/lib/Transport/TTransport.php
+++ b/lib/php/lib/Transport/TTransport.php
@@ -22,6 +22,7 @@
 
 namespace Thrift\Transport;
 
+use Thrift\Exception\TTransportException;
 use Thrift\Factory\TStringFuncFactory;
 
 /**