You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2014/11/16 22:43:08 UTC

[2/2] thrift git commit: THRIFT-2807 PHP CS Fix

THRIFT-2807 PHP CS Fix

This closes #252

Patch: Roger Thomas


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/6fb59237
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/6fb59237
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/6fb59237

Branch: refs/heads/master
Commit: 6fb5923711a1ad9e90f7b55f724be5db5e299bbf
Parents: 5effab6
Author: Roger Thomas <ro...@gmail.com>
Authored: Tue Nov 4 10:09:23 2014 +0000
Committer: Roger Meier <ro...@apache.org>
Committed: Sun Nov 16 22:41:20 2014 +0100

----------------------------------------------------------------------
 lib/php/lib/Thrift/Base/TBase.php               |  35 ++-
 .../Thrift/ClassLoader/ThriftClassLoader.php    |  45 ++--
 .../Thrift/Exception/TApplicationException.php  |  14 +-
 lib/php/lib/Thrift/Exception/TException.php     |  30 ++-
 .../lib/Thrift/Exception/TProtocolException.php |   8 +-
 .../Thrift/Exception/TTransportException.php    |  11 +-
 .../Thrift/Factory/TBinaryProtocolFactory.php   |  12 +-
 .../Thrift/Factory/TCompactProtocolFactory.php  |  13 +-
 .../lib/Thrift/Factory/TJSONProtocolFactory.php |   1 -
 lib/php/lib/Thrift/Factory/TProtocolFactory.php |   3 +-
 .../lib/Thrift/Factory/TStringFuncFactory.php   |  15 +-
 .../lib/Thrift/Factory/TTransportFactory.php    |   6 +-
 .../lib/Thrift/Protocol/JSON/BaseContext.php    |   8 +-
 .../lib/Thrift/Protocol/JSON/ListContext.php    |  12 +-
 .../Thrift/Protocol/JSON/LookaheadReader.php    |   9 +-
 .../lib/Thrift/Protocol/JSON/PairContext.php    |  18 +-
 lib/php/lib/Thrift/Protocol/TBinaryProtocol.php | 163 ++++++++-----
 .../Protocol/TBinaryProtocolAccelerated.php     |  17 +-
 .../lib/Thrift/Protocol/TCompactProtocol.php    | 226 ++++++++++++------
 lib/php/lib/Thrift/Protocol/TJSONProtocol.php   | 231 ++++++++++++-------
 .../Thrift/Protocol/TMultiplexedProtocol.php    |   1 -
 lib/php/lib/Thrift/Protocol/TProtocol.php       | 102 ++++----
 .../lib/Thrift/Protocol/TProtocolDecorator.php  |   4 +-
 .../lib/Thrift/Serializer/TBinarySerializer.php |  13 +-
 lib/php/lib/Thrift/Server/TForkingServer.php    |  31 +--
 lib/php/lib/Thrift/Server/TServer.php           |   5 +-
 lib/php/lib/Thrift/Server/TServerSocket.php     |  20 +-
 lib/php/lib/Thrift/Server/TServerTransport.php  |   8 +-
 lib/php/lib/Thrift/Server/TSimpleServer.php     |  13 +-
 lib/php/lib/Thrift/StringFunc/Core.php          |  16 +-
 lib/php/lib/Thrift/StringFunc/Mbstring.php      |  15 +-
 lib/php/lib/Thrift/StringFunc/TStringFunc.php   |   5 +-
 lib/php/lib/Thrift/TMultiplexedProcessor.php    |  23 +-
 .../lib/Thrift/Transport/TBufferedTransport.php |  41 ++--
 lib/php/lib/Thrift/Transport/TCurlClient.php    |  33 ++-
 .../lib/Thrift/Transport/TFramedTransport.php   |  34 ++-
 lib/php/lib/Thrift/Transport/THttpClient.php    |  30 ++-
 lib/php/lib/Thrift/Transport/TMemoryBuffer.php  |  24 +-
 lib/php/lib/Thrift/Transport/TNullTransport.php |  11 +-
 lib/php/lib/Thrift/Transport/TPhpStream.php     |  31 ++-
 lib/php/lib/Thrift/Transport/TSocket.php        |  53 +++--
 lib/php/lib/Thrift/Transport/TSocketPool.php    |  39 ++--
 lib/php/lib/Thrift/Transport/TTransport.php     |  18 +-
 lib/php/lib/Thrift/Type/TConstant.php           |   5 +-
 lib/php/lib/Thrift/Type/TMessageType.php        |   5 +-
 lib/php/lib/Thrift/Type/TType.php               |   3 +-
 lib/php/src/TStringUtils.php                    |  33 ++-
 lib/php/src/Thrift.php                          |  86 ++++---
 lib/php/src/autoload.php                        |   6 +-
 lib/php/test/Test/Thrift/Fixtures.php           |   7 +-
 .../Thrift/JsonSerialize/JsonSerializeTest.php  |  33 +--
 .../Thrift/Protocol/TestBinarySerializer.php    |   3 +-
 .../Test/Thrift/Protocol/TestTJSONProtocol.php  |  76 +++---
 lib/php/test/Test/Thrift/TestValidators.php     |  34 ++-
 54 files changed, 1072 insertions(+), 666 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Base/TBase.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Base/TBase.php b/lib/php/lib/Thrift/Base/TBase.php
index 3d5b526..4195f75 100644
--- a/lib/php/lib/Thrift/Base/TBase.php
+++ b/lib/php/lib/Thrift/Base/TBase.php
@@ -31,8 +31,8 @@ use Thrift\Type\TType;
  * of PHP. Note that code is intentionally duplicated in here to avoid making
  * function calls for every field or member of a container..
  */
-abstract class TBase {
-
+abstract class TBase
+{
   static $tmethod = array(TType::BOOL   => 'Bool',
                           TType::BYTE   => 'Byte',
                           TType::I16    => 'I16',
@@ -41,11 +41,12 @@ abstract class TBase {
                           TType::DOUBLE => 'Double',
                           TType::STRING => 'String');
 
-  abstract function read($input);
+  abstract public function read($input);
 
-  abstract function write($output);
+  abstract public function write($output);
 
-  public function __construct($spec=null, $vals=null) {
+  public function __construct($spec=null, $vals=null)
+  {
     if (is_array($spec) && is_array($vals)) {
       foreach ($spec as $fid => $fspec) {
         $var = $fspec['var'];
@@ -61,7 +62,8 @@ abstract class TBase {
     $this->__construct(get_object_vars($this));
   }
 
-  private function _readMap(&$var, $spec, $input) {
+  private function _readMap(&$var, $spec, $input)
+  {
     $xfer = 0;
     $ktype = $spec['ktype'];
     $vtype = $spec['vtype'];
@@ -124,10 +126,12 @@ abstract class TBase {
       $var[$key] = $val;
     }
     $xfer += $input->readMapEnd();
+
     return $xfer;
   }
 
-  private function _readList(&$var, $spec, $input, $set=false) {
+  private function _readList(&$var, $spec, $input, $set=false)
+  {
     $xfer = 0;
     $etype = $spec['etype'];
     $eread = $vread = null;
@@ -177,10 +181,12 @@ abstract class TBase {
     } else {
       $xfer += $input->readListEnd();
     }
+
     return $xfer;
   }
 
-  protected function _read($class, $spec, $input) {
+  protected function _read($class, $spec, $input)
+  {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
@@ -226,10 +232,12 @@ abstract class TBase {
       $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
+
     return $xfer;
   }
 
-  private function _writeMap($var, $spec, $output) {
+  private function _writeMap($var, $spec, $output)
+  {
     $xfer = 0;
     $ktype = $spec['ktype'];
     $vtype = $spec['vtype'];
@@ -284,10 +292,12 @@ abstract class TBase {
       }
     }
     $xfer += $output->writeMapEnd();
+
     return $xfer;
   }
 
-  private function _writeList($var, $spec, $output, $set=false) {
+  private function _writeList($var, $spec, $output, $set=false)
+  {
     $xfer = 0;
     $etype = $spec['etype'];
     $ewrite = null;
@@ -327,10 +337,12 @@ abstract class TBase {
     } else {
       $xfer += $output->writeListEnd();
     }
+
     return $xfer;
   }
 
-  protected function _write($class, $spec, $output) {
+  protected function _write($class, $spec, $output)
+  {
     $xfer = 0;
     $xfer += $output->writeStructBegin($class);
     foreach ($spec as $fid => $fspec) {
@@ -362,6 +374,7 @@ abstract class TBase {
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
+
     return $xfer;
   }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php b/lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php
index bce93f5..67575ce 100644
--- a/lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php
+++ b/lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php
@@ -18,7 +18,7 @@
  * under the License.
  *
  * ClassLoader to load Thrift library and definitions
- * Inspired from UniversalClassLoader from Symfony 2 
+ * Inspired from UniversalClassLoader from Symfony 2
  *
  * @package thrift.classloader
  */
@@ -54,7 +54,7 @@ class ThriftClassLoader
     /**
      * Set autoloader to use APC cache
      * @param boolean $apc
-     * @param string $apc_prefix
+     * @param string  $apc_prefix
      */
     public function __construct($apc = false, $apc_prefix = null)
     {
@@ -112,7 +112,7 @@ class ThriftClassLoader
 
     /**
      * Loads the given class or interface in APC.
-     * @param string $class The name of the class
+     * @param  string $class The name of the class
      * @return string
      */
     protected function findFileInApc($class)
@@ -126,33 +126,28 @@ class ThriftClassLoader
 
     /**
      * Find class in namespaces or definitions directories
-     * @param string $class
+     * @param  string $class
      * @return string
      */
     public function findFile($class)
     {
         // Remove first backslash
-        if ('\\' == $class[0])
-        {
+        if ('\\' == $class[0]) {
             $class = substr($class, 1);
         }
 
-        if (false !== $pos = strrpos($class, '\\'))
-        {
+        if (false !== $pos = strrpos($class, '\\')) {
             // Namespaced class name
             $namespace = substr($class, 0, $pos);
 
             // Iterate in normal namespaces
-            foreach ($this->namespaces as $ns => $dirs)
-            {
+            foreach ($this->namespaces as $ns => $dirs) {
                 //Don't interfere with other autoloaders
-                if (0 !== strpos($namespace, $ns))
-                {
+                if (0 !== strpos($namespace, $ns)) {
                     continue;
                 }
 
-                foreach ($dirs as $dir)
-                {
+                foreach ($dirs as $dir) {
                     $className = substr($class, $pos + 1);
 
                     $file = $dir.DIRECTORY_SEPARATOR.
@@ -160,8 +155,7 @@ class ThriftClassLoader
                                  DIRECTORY_SEPARATOR.
                                  $className.'.php';
 
-                    if (file_exists($file))
-                    {
+                    if (file_exists($file)) {
                         return $file;
                     }
                 }
@@ -173,24 +167,20 @@ class ThriftClassLoader
             $m = explode('\\', $class);
 
             // Ignore wrong call
-            if(count($m) <= 1)
-            {
+            if (count($m) <= 1) {
                 return;
             }
 
             $class = array_pop($m);
             $namespace = implode('\\', $m);
 
-            foreach ($this->definitions as $ns => $dirs)
-            {
+            foreach ($this->definitions as $ns => $dirs) {
                 //Don't interfere with other autoloaders
-                if (0 !== strpos($namespace, $ns))
-                {
+                if (0 !== strpos($namespace, $ns)) {
                     continue;
                 }
 
-                foreach ($dirs as $dir)
-                {
+                foreach ($dirs as $dir) {
                     /**
                      * Available in service: Interface, Client, Processor, Rest
                      * And every service methods (_.+)
@@ -201,9 +191,7 @@ class ThriftClassLoader
                     )
                     {
                         $className = 'Types';
-                    }
-                    else
-                    {
+                    } else {
                         $className = $n[1];
                     }
 
@@ -212,8 +200,7 @@ class ThriftClassLoader
                                  DIRECTORY_SEPARATOR .
                                  $className . '.php';
 
-                    if (file_exists($file))
-                    {
+                    if (file_exists($file)) {
                         return $file;
                     }
                 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Exception/TApplicationException.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Exception/TApplicationException.php b/lib/php/lib/Thrift/Exception/TApplicationException.php
index 9081973..b1689fc 100644
--- a/lib/php/lib/Thrift/Exception/TApplicationException.php
+++ b/lib/php/lib/Thrift/Exception/TApplicationException.php
@@ -22,10 +22,10 @@
 
 namespace Thrift\Exception;
 
-use Thrift\Exception\TException;
 use Thrift\Type\TType;
 
-class TApplicationException extends TException {
+class TApplicationException extends TException
+{
   static $_TSPEC =
     array(1 => array('var' => 'message',
                      'type' => TType::STRING),
@@ -44,15 +44,18 @@ class TApplicationException extends TException {
   const INVALID_PROTOCOL = 9;
   const UNSUPPORTED_CLIENT_TYPE = 10;
 
-  function __construct($message=null, $code=0) {
+  public function __construct($message=null, $code=0)
+  {
     parent::__construct($message, $code);
   }
 
-  public function read($output) {
+  public function read($output)
+  {
     return $this->_read('TApplicationException', self::$_TSPEC, $output);
   }
 
-  public function write($output) {
+  public function write($output)
+  {
     $xfer = 0;
     $xfer += $output->writeStructBegin('TApplicationException');
     if ($message = $this->getMessage()) {
@@ -67,6 +70,7 @@ class TApplicationException extends TException {
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
+
     return $xfer;
   }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Exception/TException.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Exception/TException.php b/lib/php/lib/Thrift/Exception/TException.php
index 8e8cd28..5c06843 100644
--- a/lib/php/lib/Thrift/Exception/TException.php
+++ b/lib/php/lib/Thrift/Exception/TException.php
@@ -38,8 +38,10 @@ use Thrift\Base\TBase;
  * @param mixed $p1 Message (string) or type-spec (array)
  * @param mixed $p2 Code (integer) or values (array)
  */
-class TException extends \Exception {
-  function __construct($p1=null, $p2=0) {
+class TException extends \Exception
+{
+  public function __construct($p1=null, $p2=0)
+  {
     if (is_array($p1) && is_array($p2)) {
       $spec = $p1;
       $vals = $p2;
@@ -62,7 +64,8 @@ class TException extends \Exception {
                           TType::DOUBLE => 'Double',
                           TType::STRING => 'String');
 
-  private function _readMap(&$var, $spec, $input) {
+  private function _readMap(&$var, $spec, $input)
+  {
     $xfer = 0;
     $ktype = $spec['ktype'];
     $vtype = $spec['vtype'];
@@ -125,10 +128,12 @@ class TException extends \Exception {
       $var[$key] = $val;
     }
     $xfer += $input->readMapEnd();
+
     return $xfer;
   }
 
-  private function _readList(&$var, $spec, $input, $set=false) {
+  private function _readList(&$var, $spec, $input, $set=false)
+  {
     $xfer = 0;
     $etype = $spec['etype'];
     $eread = $vread = null;
@@ -178,10 +183,12 @@ class TException extends \Exception {
     } else {
       $xfer += $input->readListEnd();
     }
+
     return $xfer;
   }
 
-  protected function _read($class, $spec, $input) {
+  protected function _read($class, $spec, $input)
+  {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
@@ -227,10 +234,12 @@ class TException extends \Exception {
       $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
+
     return $xfer;
   }
 
-  private function _writeMap($var, $spec, $output) {
+  private function _writeMap($var, $spec, $output)
+  {
     $xfer = 0;
     $ktype = $spec['ktype'];
     $vtype = $spec['vtype'];
@@ -285,10 +294,12 @@ class TException extends \Exception {
       }
     }
     $xfer += $output->writeMapEnd();
+
     return $xfer;
   }
 
-  private function _writeList($var, $spec, $output, $set=false) {
+  private function _writeList($var, $spec, $output, $set=false)
+  {
     $xfer = 0;
     $etype = $spec['etype'];
     $ewrite = null;
@@ -328,10 +339,12 @@ class TException extends \Exception {
     } else {
       $xfer += $output->writeListEnd();
     }
+
     return $xfer;
   }
 
-  protected function _write($class, $spec, $output) {
+  protected function _write($class, $spec, $output)
+  {
     $xfer = 0;
     $xfer += $output->writeStructBegin($class);
     foreach ($spec as $fid => $fspec) {
@@ -363,6 +376,7 @@ class TException extends \Exception {
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
+
     return $xfer;
   }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Exception/TProtocolException.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Exception/TProtocolException.php b/lib/php/lib/Thrift/Exception/TProtocolException.php
index f2529f5..ba7135c 100644
--- a/lib/php/lib/Thrift/Exception/TProtocolException.php
+++ b/lib/php/lib/Thrift/Exception/TProtocolException.php
@@ -23,8 +23,6 @@
 
 namespace Thrift\Exception;
 
-use Thrift\Exception\TException;
-
 /**
  * Protocol module. Contains all the types and definitions needed to implement
  * a protocol encoder/decoder.
@@ -35,7 +33,8 @@ use Thrift\Exception\TException;
 /**
  * Protocol exceptions
  */
-class TProtocolException extends TException {
+class TProtocolException extends TException
+{
   const UNKNOWN = 0;
   const INVALID_DATA = 1;
   const NEGATIVE_SIZE = 2;
@@ -44,7 +43,8 @@ class TProtocolException extends TException {
   const NOT_IMPLEMENTED = 5;
   const DEPTH_LIMIT = 6;
 
-  function __construct($message=null, $code=0) {
+  public function __construct($message=null, $code=0)
+  {
     parent::__construct($message, $code);
   }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Exception/TTransportException.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Exception/TTransportException.php b/lib/php/lib/Thrift/Exception/TTransportException.php
index f467eb9..0074467 100644
--- a/lib/php/lib/Thrift/Exception/TTransportException.php
+++ b/lib/php/lib/Thrift/Exception/TTransportException.php
@@ -22,20 +22,19 @@
 
 namespace Thrift\Exception;
 
-use Thrift\Exception\TException;
-
 /**
  * Transport exceptions
  */
-class TTransportException extends TException {
-
+class TTransportException extends TException
+{
   const UNKNOWN = 0;
   const NOT_OPEN = 1;
   const ALREADY_OPEN = 2;
   const TIMED_OUT = 3;
   const END_OF_FILE = 4;
 
-  function __construct($message=null, $code=0) {
+  public function __construct($message=null, $code=0)
+  {
     parent::__construct($message, $code);
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Factory/TBinaryProtocolFactory.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Factory/TBinaryProtocolFactory.php b/lib/php/lib/Thrift/Factory/TBinaryProtocolFactory.php
index 85da567..0c1c4a7 100644
--- a/lib/php/lib/Thrift/Factory/TBinaryProtocolFactory.php
+++ b/lib/php/lib/Thrift/Factory/TBinaryProtocolFactory.php
@@ -22,22 +22,24 @@
 
 namespace Thrift\Factory;
 
-use Thrift\Factory\TProtocolFactory;
 use Thrift\Protocol\TBinaryProtocol;
 
 /**
  * Binary Protocol Factory
  */
-class TBinaryProtocolFactory implements TProtocolFactory {
+class TBinaryProtocolFactory implements TProtocolFactory
+{
   private $strictRead_ = false;
   private $strictWrite_ = false;
 
-  public function __construct($strictRead=false, $strictWrite=false) {
+  public function __construct($strictRead=false, $strictWrite=false)
+  {
     $this->strictRead_ = $strictRead;
     $this->strictWrite_ = $strictWrite;
   }
 
-  public function getProtocol($trans) {
+  public function getProtocol($trans)
+  {
     return new TBinaryProtocol($trans, $this->strictRead_, $this->strictWrite_);
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Factory/TCompactProtocolFactory.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Factory/TCompactProtocolFactory.php b/lib/php/lib/Thrift/Factory/TCompactProtocolFactory.php
index 9f972aa..f4b4fe3 100644
--- a/lib/php/lib/Thrift/Factory/TCompactProtocolFactory.php
+++ b/lib/php/lib/Thrift/Factory/TCompactProtocolFactory.php
@@ -22,18 +22,19 @@
 
 namespace Thrift\Factory;
 
-use Thrift\Factory\TProtocolFactory;
 use Thrift\Protocol\TCompactProtocol;
 
 /**
  * Compact Protocol Factory
  */
-class TCompactProtocolFactory implements TProtocolFactory {
-
-  public function __construct() {
+class TCompactProtocolFactory implements TProtocolFactory
+{
+  public function __construct()
+  {
   }
 
-  public function getProtocol($trans) {
+  public function getProtocol($trans)
+  {
     return new TCompactProtocol($trans);
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Factory/TJSONProtocolFactory.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Factory/TJSONProtocolFactory.php b/lib/php/lib/Thrift/Factory/TJSONProtocolFactory.php
index 27e4391..fbfb1d7 100644
--- a/lib/php/lib/Thrift/Factory/TJSONProtocolFactory.php
+++ b/lib/php/lib/Thrift/Factory/TJSONProtocolFactory.php
@@ -22,7 +22,6 @@
 
 namespace Thrift\Factory;
 
-use Thrift\Factory\TProtocolFactory;
 use Thrift\Protocol\TJSONProtocol;
 
 /**

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Factory/TProtocolFactory.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Factory/TProtocolFactory.php b/lib/php/lib/Thrift/Factory/TProtocolFactory.php
index 6b322eb..4c9562d 100644
--- a/lib/php/lib/Thrift/Factory/TProtocolFactory.php
+++ b/lib/php/lib/Thrift/Factory/TProtocolFactory.php
@@ -25,7 +25,8 @@ namespace Thrift\Factory;
 /**
  * Protocol factory creates protocol objects from transports
  */
-interface TProtocolFactory {
+interface TProtocolFactory
+{
   /**
    * Build a protocol from the base transport
    *

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Factory/TStringFuncFactory.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Factory/TStringFuncFactory.php b/lib/php/lib/Thrift/Factory/TStringFuncFactory.php
index edc3649..6ad6839 100644
--- a/lib/php/lib/Thrift/Factory/TStringFuncFactory.php
+++ b/lib/php/lib/Thrift/Factory/TStringFuncFactory.php
@@ -24,7 +24,8 @@ namespace Thrift\Factory;
 use Thrift\StringFunc\Mbstring;
 use Thrift\StringFunc\Core;
 
-class TStringFuncFactory {
+class TStringFuncFactory
+{
     private static $_instance;
 
     /**
@@ -33,22 +34,24 @@ class TStringFuncFactory {
      *
      * @return TStringFunc
      */
-    public static function create() {
-        if(!self::$_instance) {
+    public static function create()
+    {
+        if (!self::$_instance) {
             self::_setInstance();
         }
 
         return self::$_instance;
     }
 
-    private static function _setInstance() {
+    private static function _setInstance()
+    {
         /**
          * 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
          */
-        if(ini_get('mbstring.func_overload') & 2) {
+        if (ini_get('mbstring.func_overload') & 2) {
             self::$_instance = new Mbstring();
         }
         /**
@@ -60,4 +63,4 @@ class TStringFuncFactory {
             self::$_instance = new Core();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Factory/TTransportFactory.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Factory/TTransportFactory.php b/lib/php/lib/Thrift/Factory/TTransportFactory.php
index f3ae123..b32b5f4 100644
--- a/lib/php/lib/Thrift/Factory/TTransportFactory.php
+++ b/lib/php/lib/Thrift/Factory/TTransportFactory.php
@@ -4,13 +4,15 @@ namespace Thrift\Factory;
 
 use Thrift\Transport\TTransport;
 
-class TTransportFactory {
+class TTransportFactory
+{
   /**
    * @static
    * @param TTransport $transport
    * @return TTransport
    */
-  public static function getTransport(TTransport $transport) {
+  public static function getTransport(TTransport $transport)
+  {
     return $transport;
   }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/JSON/BaseContext.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/JSON/BaseContext.php b/lib/php/lib/Thrift/Protocol/JSON/BaseContext.php
index e96e504..31bcb48 100644
--- a/lib/php/lib/Thrift/Protocol/JSON/BaseContext.php
+++ b/lib/php/lib/Thrift/Protocol/JSON/BaseContext.php
@@ -24,16 +24,16 @@ namespace Thrift\Protocol\JSON;
 
 class BaseContext
 {
-    function escapeNum()
+    public function escapeNum()
     {
         return false;
     }
 
-    function write()
+    public function write()
     {
     }
 
-    function read()
+    public function read()
     {
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/JSON/ListContext.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/JSON/ListContext.php b/lib/php/lib/Thrift/Protocol/JSON/ListContext.php
index a2b75b1..eef6594 100644
--- a/lib/php/lib/Thrift/Protocol/JSON/ListContext.php
+++ b/lib/php/lib/Thrift/Protocol/JSON/ListContext.php
@@ -22,7 +22,6 @@
 
 namespace Thrift\Protocol\JSON;
 
-use Thrift\Protocol\JSON\BaseContext;
 use Thrift\Protocol\TJSONProtocol;
 
 class ListContext extends BaseContext
@@ -30,11 +29,13 @@ class ListContext extends BaseContext
     private $first_ = true;
     private $p_;
 
-    public function __construct($p) {
+    public function __construct($p)
+    {
         $this->p_ = $p;
     }
 
-    public function write() {
+    public function write()
+    {
         if ($this->first_) {
             $this->first_ = false;
         } else {
@@ -42,11 +43,12 @@ class ListContext extends BaseContext
         }
     }
 
-    public function read() {
+    public function read()
+    {
         if ($this->first_) {
             $this->first_ = false;
         } else {
             $this->p_->readJSONSyntaxChar(TJSONProtocol::COMMA);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/JSON/LookaheadReader.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/JSON/LookaheadReader.php b/lib/php/lib/Thrift/Protocol/JSON/LookaheadReader.php
index 128b5fc..0b18c40 100644
--- a/lib/php/lib/Thrift/Protocol/JSON/LookaheadReader.php
+++ b/lib/php/lib/Thrift/Protocol/JSON/LookaheadReader.php
@@ -33,7 +33,8 @@ class LookaheadReader
         $this->p_ = $p;
     }
 
-    public function read() {
+    public function read()
+    {
         if ($this->hasData_) {
             $this->hasData_ = false;
         } else {
@@ -43,12 +44,14 @@ class LookaheadReader
         return substr($this->data_, 0, 1);
     }
 
-    public function peek() {
+    public function peek()
+    {
         if (!$this->hasData_) {
             $this->data_ = $this->p_->getTransport()->readAll(1);
         }
 
         $this->hasData_ = true;
+
         return substr($this->data_, 0, 1);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/JSON/PairContext.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/JSON/PairContext.php b/lib/php/lib/Thrift/Protocol/JSON/PairContext.php
index 1c87dd3..7b353c4 100644
--- a/lib/php/lib/Thrift/Protocol/JSON/PairContext.php
+++ b/lib/php/lib/Thrift/Protocol/JSON/PairContext.php
@@ -22,19 +22,21 @@
 
 namespace Thrift\Protocol\JSON;
 
-use Thrift\Protocol\JSON\BaseContext;
 use Thrift\Protocol\TJSONProtocol;
 
-class PairContext extends BaseContext {
+class PairContext extends BaseContext
+{
     private $first_ = true;
     private $colon_ = true;
     private $p_ = null;
 
-    public function __construct($p) {
+    public function __construct($p)
+    {
         $this->p_ = $p;
     }
 
-    public function write() {
+    public function write()
+    {
         if ($this->first_) {
             $this->first_ = false;
             $this->colon_ = true;
@@ -44,7 +46,8 @@ class PairContext extends BaseContext {
         }
     }
 
-    public function read() {
+    public function read()
+    {
         if ($this->first_) {
             $this->first_ = false;
             $this->colon_ = true;
@@ -54,7 +57,8 @@ class PairContext extends BaseContext {
         }
     }
 
-    public function escapeNum() {
+    public function escapeNum()
+    {
         return $this->colon_;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TBinaryProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TBinaryProtocol.php b/lib/php/lib/Thrift/Protocol/TBinaryProtocol.php
index b1fddac..fe6a103 100644
--- a/lib/php/lib/Thrift/Protocol/TBinaryProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TBinaryProtocol.php
@@ -22,7 +22,6 @@
 
 namespace Thrift\Protocol;
 
-use Thrift\Protocol\TProtocol;
 use Thrift\Type\TType;
 use Thrift\Exception\TProtocolException;
 use Thrift\Factory\TStringFuncFactory;
@@ -31,23 +30,26 @@ use Thrift\Factory\TStringFuncFactory;
  * Binary implementation of the Thrift protocol.
  *
  */
-class TBinaryProtocol extends TProtocol {
-
+class TBinaryProtocol extends TProtocol
+{
   const VERSION_MASK = 0xffff0000;
   const VERSION_1 = 0x80010000;
 
   protected $strictRead_ = false;
   protected $strictWrite_ = true;
 
-  public function __construct($trans, $strictRead=false, $strictWrite=true) {
+  public function __construct($trans, $strictRead=false, $strictWrite=true)
+  {
     parent::__construct($trans);
     $this->strictRead_ = $strictRead;
     $this->strictWrite_ = $strictWrite;
   }
 
-  public function writeMessageBegin($name, $type, $seqid) {
+  public function writeMessageBegin($name, $type, $seqid)
+  {
     if ($this->strictWrite_) {
       $version = self::VERSION_1 | $type;
+
       return
         $this->writeI32($version) +
         $this->writeString($name) +
@@ -60,89 +62,110 @@ class TBinaryProtocol extends TProtocol {
     }
   }
 
-  public function writeMessageEnd() {
+  public function writeMessageEnd()
+  {
     return 0;
   }
 
-  public function writeStructBegin($name) {
+  public function writeStructBegin($name)
+  {
     return 0;
   }
 
-  public function writeStructEnd() {
+  public function writeStructEnd()
+  {
     return 0;
   }
 
-  public function writeFieldBegin($fieldName, $fieldType, $fieldId) {
+  public function writeFieldBegin($fieldName, $fieldType, $fieldId)
+  {
     return
       $this->writeByte($fieldType) +
       $this->writeI16($fieldId);
   }
 
-  public function writeFieldEnd() {
+  public function writeFieldEnd()
+  {
     return 0;
   }
 
-  public function writeFieldStop() {
+  public function writeFieldStop()
+  {
     return
       $this->writeByte(TType::STOP);
   }
 
-  public function writeMapBegin($keyType, $valType, $size) {
+  public function writeMapBegin($keyType, $valType, $size)
+  {
     return
       $this->writeByte($keyType) +
       $this->writeByte($valType) +
       $this->writeI32($size);
   }
 
-  public function writeMapEnd() {
+  public function writeMapEnd()
+  {
     return 0;
   }
 
-  public function writeListBegin($elemType, $size) {
+  public function writeListBegin($elemType, $size)
+  {
     return
       $this->writeByte($elemType) +
       $this->writeI32($size);
   }
 
-  public function writeListEnd() {
+  public function writeListEnd()
+  {
     return 0;
   }
 
-  public function writeSetBegin($elemType, $size) {
+  public function writeSetBegin($elemType, $size)
+  {
     return
       $this->writeByte($elemType) +
       $this->writeI32($size);
   }
 
-  public function writeSetEnd() {
+  public function writeSetEnd()
+  {
     return 0;
   }
 
-  public function writeBool($value) {
+  public function writeBool($value)
+  {
     $data = pack('c', $value ? 1 : 0);
     $this->trans_->write($data, 1);
+
     return 1;
   }
 
-  public function writeByte($value) {
+  public function writeByte($value)
+  {
     $data = pack('c', $value);
     $this->trans_->write($data, 1);
+
     return 1;
   }
 
-  public function writeI16($value) {
+  public function writeI16($value)
+  {
     $data = pack('n', $value);
     $this->trans_->write($data, 2);
+
     return 2;
   }
 
-  public function writeI32($value) {
+  public function writeI32($value)
+  {
     $data = pack('N', $value);
     $this->trans_->write($data, 4);
+
     return 4;
   }
 
-  public function writeI64($value) {
+  public function writeI64($value)
+  {
     // If we are on a 32bit architecture we have to explicitly deal with
     // 64-bit twos-complement arithmetic since PHP wants to treat all ints
     // as signed and any int over 2^31 - 1 as a float
@@ -153,13 +176,13 @@ class TBinaryProtocol extends TProtocol {
         $value *= -1;
       }
 
-      $hi = (int)($value / 4294967296);
-      $lo = (int)$value;
+      $hi = (int) ($value / 4294967296);
+      $lo = (int) $value;
 
       if ($neg) {
         $hi = ~$hi;
         $lo = ~$lo;
-        if (($lo & (int)0xffffffff) == (int)0xffffffff) {
+        if (($lo & (int) 0xffffffff) == (int) 0xffffffff) {
           $lo = 0;
           $hi++;
         } else {
@@ -175,25 +198,31 @@ class TBinaryProtocol extends TProtocol {
     }
 
     $this->trans_->write($data, 8);
+
     return 8;
   }
 
-  public function writeDouble($value) {
+  public function writeDouble($value)
+  {
     $data = pack('d', $value);
     $this->trans_->write(strrev($data), 8);
+
     return 8;
   }
 
-  public function writeString($value) {
+  public function writeString($value)
+  {
     $len = TStringFuncFactory::create()->strlen($value);
     $result = $this->writeI32($len);
     if ($len) {
       $this->trans_->write($value, $len);
     }
+
     return $result + $len;
   }
 
-  public function readMessageBegin(&$name, &$type, &$seqid) {
+  public function readMessageBegin(&$name, &$type, &$seqid)
+  {
     $result = $this->readI32($sz);
     if ($sz < 0) {
       $version = (int) ($sz & self::VERSION_MASK);
@@ -216,102 +245,126 @@ class TBinaryProtocol extends TProtocol {
           $this->readI32($seqid);
       }
     }
+
     return $result;
   }
 
-  public function readMessageEnd() {
+  public function readMessageEnd()
+  {
     return 0;
   }
 
-  public function readStructBegin(&$name) {
+  public function readStructBegin(&$name)
+  {
     $name = '';
+
     return 0;
   }
 
-  public function readStructEnd() {
+  public function readStructEnd()
+  {
     return 0;
   }
 
-  public function readFieldBegin(&$name, &$fieldType, &$fieldId) {
+  public function readFieldBegin(&$name, &$fieldType, &$fieldId)
+  {
     $result = $this->readByte($fieldType);
     if ($fieldType == TType::STOP) {
       $fieldId = 0;
+
       return $result;
     }
     $result += $this->readI16($fieldId);
+
     return $result;
   }
 
-  public function readFieldEnd() {
+  public function readFieldEnd()
+  {
     return 0;
   }
 
-  public function readMapBegin(&$keyType, &$valType, &$size) {
+  public function readMapBegin(&$keyType, &$valType, &$size)
+  {
     return
       $this->readByte($keyType) +
       $this->readByte($valType) +
       $this->readI32($size);
   }
 
-  public function readMapEnd() {
+  public function readMapEnd()
+  {
     return 0;
   }
 
-  public function readListBegin(&$elemType, &$size) {
+  public function readListBegin(&$elemType, &$size)
+  {
     return
       $this->readByte($elemType) +
       $this->readI32($size);
   }
 
-  public function readListEnd() {
+  public function readListEnd()
+  {
     return 0;
   }
 
-  public function readSetBegin(&$elemType, &$size) {
+  public function readSetBegin(&$elemType, &$size)
+  {
     return
       $this->readByte($elemType) +
       $this->readI32($size);
   }
 
-  public function readSetEnd() {
+  public function readSetEnd()
+  {
     return 0;
   }
 
-  public function readBool(&$value) {
+  public function readBool(&$value)
+  {
     $data = $this->trans_->readAll(1);
     $arr = unpack('c', $data);
     $value = $arr[1] == 1;
+
     return 1;
   }
 
-  public function readByte(&$value) {
+  public function readByte(&$value)
+  {
     $data = $this->trans_->readAll(1);
     $arr = unpack('c', $data);
     $value = $arr[1];
+
     return 1;
   }
 
-  public function readI16(&$value) {
+  public function readI16(&$value)
+  {
     $data = $this->trans_->readAll(2);
     $arr = unpack('n', $data);
     $value = $arr[1];
     if ($value > 0x7fff) {
       $value = 0 - (($value - 1) ^ 0xffff);
     }
+
     return 2;
   }
 
-  public function readI32(&$value) {
+  public function readI32(&$value)
+  {
     $data = $this->trans_->readAll(4);
     $arr = unpack('N', $data);
     $value = $arr[1];
     if ($value > 0x7fffffff) {
       $value = 0 - (($value - 1) ^ 0xffffffff);
     }
+
     return 4;
   }
 
-  public function readI64(&$value) {
+  public function readI64(&$value)
+  {
     $data = $this->trans_->readAll(8);
 
     $arr = unpack('N2', $data);
@@ -327,10 +380,10 @@ class TBinaryProtocol extends TProtocol {
 
       // Check for a negative
       if ($isNeg) {
-        $hi = ~$hi & (int)0xffffffff;
-        $lo = ~$lo & (int)0xffffffff;
+        $hi = ~$hi & (int) 0xffffffff;
+        $lo = ~$lo & (int) 0xffffffff;
 
-        if ($lo == (int)0xffffffff) {
+        if ($lo == (int) 0xffffffff) {
           $hi++;
           $lo = 0;
         } else {
@@ -341,13 +394,13 @@ class TBinaryProtocol extends TProtocol {
       // Force 32bit words in excess of 2G to pe positive - we deal wigh sign
       // explicitly below
 
-      if ($hi & (int)0x80000000) {
-        $hi &= (int)0x7fffffff;
+      if ($hi & (int) 0x80000000) {
+        $hi &= (int) 0x7fffffff;
         $hi += 0x80000000;
       }
 
-      if ($lo & (int)0x80000000) {
-        $lo &= (int)0x7fffffff;
+      if ($lo & (int) 0x80000000) {
+        $lo &= (int) 0x7fffffff;
         $lo += 0x80000000;
       }
 
@@ -377,20 +430,24 @@ class TBinaryProtocol extends TProtocol {
     return 8;
   }
 
-  public function readDouble(&$value) {
+  public function readDouble(&$value)
+  {
     $data = strrev($this->trans_->readAll(8));
     $arr = unpack('d', $data);
     $value = $arr[1];
+
     return 8;
   }
 
-  public function readString(&$value) {
+  public function readString(&$value)
+  {
     $result = $this->readI32($len);
     if ($len) {
       $value = $this->trans_->readAll($len);
     } else {
       $value = '';
     }
+
     return $result + $len;
   }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TBinaryProtocolAccelerated.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TBinaryProtocolAccelerated.php b/lib/php/lib/Thrift/Protocol/TBinaryProtocolAccelerated.php
index 7a40ce9..f0e0bb9 100644
--- a/lib/php/lib/Thrift/Protocol/TBinaryProtocolAccelerated.php
+++ b/lib/php/lib/Thrift/Protocol/TBinaryProtocolAccelerated.php
@@ -22,18 +22,19 @@
 
 namespace Thrift\Protocol;
 
-use Thrift\Protocol\TBinaryProtocol;
 use Thrift\Transport\TBufferedTransport;
 
 /**
  * Accelerated binary protocol: used in conjunction with the thrift_protocol
  * extension for faster deserialization
  */
-class TBinaryProtocolAccelerated extends TBinaryProtocol {
-  public function __construct($trans, $strictRead=false, $strictWrite=true) {
+class TBinaryProtocolAccelerated extends TBinaryProtocol
+{
+  public function __construct($trans, $strictRead=false, $strictWrite=true)
+  {
     // If the transport doesn't implement putBack, wrap it in a
     // TBufferedTransport (which does)
-    
+
     // NOTE (t.heintz): This is very evil to do, because the TBufferedTransport may swallow bytes, which
     // are then never written to the underlying transport. This happens precisely when a number of bytes
     // less than the max buffer size (512 by default) is written to the transport and then flush() is NOT
@@ -47,16 +48,18 @@ class TBinaryProtocolAccelerated extends TBinaryProtocol {
     // I am leaving this code in nonetheless, because there may be applications depending on this behavior.
     //
     // @see THRIFT-1579
-    
+
     if (!method_exists($trans, 'putBack')) {
       $trans = new TBufferedTransport($trans);
     }
     parent::__construct($trans, $strictRead, $strictWrite);
   }
-  public function isStrictRead() {
+  public function isStrictRead()
+  {
     return $this->strictRead_;
   }
-  public function isStrictWrite() {
+  public function isStrictWrite()
+  {
     return $this->strictWrite_;
   }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
index b8a71d6..2870351 100644
--- a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
@@ -22,7 +22,6 @@
 
 namespace Thrift\Protocol;
 
-use Thrift\Protocol\TProtocol;
 use Thrift\Type\TType;
 use Thrift\Exception\TProtocolException;
 use Thrift\Factory\TStringFuncFactory;
@@ -31,8 +30,8 @@ use Thrift\Factory\TStringFuncFactory;
  * Compact implementation of the Thrift protocol.
  *
  */
-class TCompactProtocol extends TProtocol {
-
+class TCompactProtocol extends TProtocol
+{
   const COMPACT_STOP = 0x00;
   const COMPACT_TRUE = 0x01;
   const COMPACT_FALSE = 0x02;
@@ -103,15 +102,18 @@ class TCompactProtocol extends TProtocol {
   protected $containers = array();
 
   // Some varint / zigzag helper methods
-  public function toZigZag($n, $bits) {
+  public function toZigZag($n, $bits)
+  {
     return ($n << 1) ^ ($n >> ($bits - 1));
   }
 
-  public function fromZigZag($n) {
+  public function fromZigZag($n)
+  {
     return ($n >> 1) ^ -($n & 1);
   }
 
-  public function getVarint($data) {
+  public function getVarint($data)
+  {
     $out = "";
     while (true) {
       if (($data & ~0x7f) === 0) {
@@ -122,17 +124,21 @@ class TCompactProtocol extends TProtocol {
         $data = $data >> 7;
       }
     }
+
     return $out;
   }
 
-  public function writeVarint($data) {
+  public function writeVarint($data)
+  {
     $out = $this->getVarint($data);
     $result = TStringFuncFactory::create()->strlen($out);
     $this->trans_->write($out, $result);
+
     return $result;
   }
 
-  public function readVarint(&$result) {
+  public function readVarint(&$result)
+  {
     $idx = 0;
     $shift = 0;
     $result = 0;
@@ -151,11 +157,13 @@ class TCompactProtocol extends TProtocol {
     return $idx;
   }
 
-  public function __construct($trans) {
+  public function __construct($trans)
+  {
     parent::__construct($trans);
   }
 
-  public function writeMessageBegin($name, $type, $seqid) {
+  public function writeMessageBegin($name, $type, $seqid)
+  {
     $written =
       $this->writeUByte(TCompactProtocol::PROTOCOL_ID) +
       $this->writeUByte(TCompactProtocol::VERSION |
@@ -163,33 +171,42 @@ class TCompactProtocol extends TProtocol {
       $this->writeVarint($seqid) +
       $this->writeString($name);
     $this->state = TCompactProtocol::STATE_VALUE_WRITE;
+
     return $written;
   }
 
-  public function writeMessageEnd() {
+  public function writeMessageEnd()
+  {
     $this->state = TCompactProtocol::STATE_CLEAR;
+
     return 0;
   }
 
-  public function writeStructBegin($name) {
+  public function writeStructBegin($name)
+  {
     $this->structs[] = array($this->state, $this->lastFid);
     $this->state = TCompactProtocol::STATE_FIELD_WRITE;
     $this->lastFid = 0;
+
     return 0;
   }
 
-  public function writeStructEnd() {
+  public function writeStructEnd()
+  {
     $old_values = array_pop($this->structs);
     $this->state = $old_values[0];
     $this->lastFid = $old_values[1];
+
     return 0;
   }
 
-  public function writeFieldStop() {
+  public function writeFieldStop()
+  {
     return $this->writeByte(0);
   }
 
-  public function writeFieldHeader($type, $fid) {
+  public function writeFieldHeader($type, $fid)
+  {
     $written = 0;
     $delta = $fid - $this->lastFid;
     if (0 < $delta && $delta <= 15) {
@@ -199,26 +216,33 @@ class TCompactProtocol extends TProtocol {
         $this->writeI16($fid);
     }
     $this->lastFid = $fid;
+
     return $written;
   }
 
-  public function writeFieldBegin($field_name, $field_type, $field_id) {
+  public function writeFieldBegin($field_name, $field_type, $field_id)
+  {
     if ($field_type == TTYPE::BOOL) {
       $this->state = TCompactProtocol::STATE_BOOL_WRITE;
       $this->boolFid = $field_id;
+
       return 0;
     } else {
       $this->state = TCompactProtocol::STATE_VALUE_WRITE;
+
       return $this->writeFieldHeader(self::$ctypes[$field_type], $field_id);
     }
   }
 
-  public function writeFieldEnd() {
+  public function writeFieldEnd()
+  {
     $this->state = TCompactProtocol::STATE_FIELD_WRITE;
+
     return 0;
   }
 
-  public function writeCollectionBegin($etype, $size) {
+  public function writeCollectionBegin($etype, $size)
+  {
     $written = 0;
     if ($size <= 14) {
       $written = $this->writeUByte($size << 4 |
@@ -234,7 +258,8 @@ class TCompactProtocol extends TProtocol {
     return $written;
   }
 
-  public function writeMapBegin($key_type, $val_type, $size) {
+  public function writeMapBegin($key_type, $val_type, $size)
+  {
     $written = 0;
     if ($size == 0) {
       $written = $this->writeByte(0);
@@ -244,89 +269,113 @@ class TCompactProtocol extends TProtocol {
                           self::$ctypes[$val_type]);
     }
     $this->containers[] = $this->state;
+
     return $written;
   }
 
-  public function writeCollectionEnd() {
+  public function writeCollectionEnd()
+  {
     $this->state = array_pop($this->containers);
+
     return 0;
   }
 
-  public function writeMapEnd() {
+  public function writeMapEnd()
+  {
     return $this->writeCollectionEnd();
   }
 
-  public function writeListBegin($elem_type, $size) {
+  public function writeListBegin($elem_type, $size)
+  {
     return $this->writeCollectionBegin($elem_type, $size);
   }
 
-  public function writeListEnd() {
+  public function writeListEnd()
+  {
     return $this->writeCollectionEnd();
   }
 
-  public function writeSetBegin($elem_type, $size) {
+  public function writeSetBegin($elem_type, $size)
+  {
     return $this->writeCollectionBegin($elem_type, $size);
   }
 
-  public function writeSetEnd() {
+  public function writeSetEnd()
+  {
     return $this->writeCollectionEnd();
   }
 
-  public function writeBool($value) {
+  public function writeBool($value)
+  {
     if ($this->state == TCompactProtocol::STATE_BOOL_WRITE) {
       $ctype = TCompactProtocol::COMPACT_FALSE;
       if ($value) {
         $ctype = TCompactProtocol::COMPACT_TRUE;
       }
+
       return $this->writeFieldHeader($ctype, $this->boolFid);
-    } else if ($this->state == TCompactProtocol::STATE_CONTAINER_WRITE) {
+    } elseif ($this->state == TCompactProtocol::STATE_CONTAINER_WRITE) {
       return $this->writeByte($value ? 1 : 0);
     } else {
       throw new TProtocolException('Invalid state in compact protocol');
     }
   }
 
-  public function writeByte($value) {
+  public function writeByte($value)
+  {
     $data = pack('c', $value);
     $this->trans_->write($data, 1);
+
     return 1;
   }
 
-  public function writeUByte($byte) {
+  public function writeUByte($byte)
+  {
     $this->trans_->write(pack('C', $byte), 1);
+
     return 1;
   }
 
-  public function writeI16($value) {
+  public function writeI16($value)
+  {
     $thing = $this->toZigZag($value, 16);
+
     return $this->writeVarint($thing);
   }
 
-  public function writeI32($value) {
+  public function writeI32($value)
+  {
     $thing = $this->toZigZag($value, 32);
+
     return $this->writeVarint($thing);
   }
 
-  public function writeDouble($value) {
+  public function writeDouble($value)
+  {
     $data = pack('d', $value);
     $this->trans_->write($data, 8);
+
     return 8;
   }
 
-  public function writeString($value) {
+  public function writeString($value)
+  {
     $len = TStringFuncFactory::create()->strlen($value);
     $result = $this->writeVarint($len);
     if ($len) {
       $this->trans_->write($value, $len);
     }
+
     return $result + $len;
   }
 
-  public function readFieldBegin(&$name, &$field_type, &$field_id) {
+  public function readFieldBegin(&$name, &$field_type, &$field_id)
+  {
     $result = $this->readUByte($field_type);
 
     if (($field_type & 0x0f) == TType::STOP) {
       $field_id = 0;
+
       return $result;
     }
     $delta = $field_type >> 4;
@@ -340,41 +389,51 @@ class TCompactProtocol extends TProtocol {
     if ($field_type == TCompactProtocol::COMPACT_TRUE) {
       $this->state = TCompactProtocol::STATE_BOOL_READ;
       $this->boolValue = true;
-    } else if ($field_type == TCompactProtocol::COMPACT_FALSE) {
+    } elseif ($field_type == TCompactProtocol::COMPACT_FALSE) {
       $this->state = TCompactProtocol::STATE_BOOL_READ;
       $this->boolValue = false;
     } else {
       $this->state = TCompactProtocol::STATE_VALUE_READ;
     }
+
     return $result;
   }
 
-  public function readFieldEnd() {
+  public function readFieldEnd()
+  {
     $this->state = TCompactProtocol::STATE_FIELD_READ;
+
     return 0;
   }
 
-  public function readUByte(&$value) {
+  public function readUByte(&$value)
+  {
     $data = $this->trans_->readAll(1);
     $arr = unpack('C', $data);
     $value = $arr[1];
+
     return 1;
   }
 
-  public function readByte(&$value) {
+  public function readByte(&$value)
+  {
     $data = $this->trans_->readAll(1);
     $arr = unpack('c', $data);
     $value = $arr[1];
+
     return 1;
   }
 
-  public function readZigZag(&$value) {
+  public function readZigZag(&$value)
+  {
     $result = $this->readVarint($value);
     $value = $this->fromZigZag($value);
+
     return $result;
   }
 
-  public function readMessageBegin(&$name, &$type, &$seqid) {
+  public function readMessageBegin(&$name, &$type, &$seqid)
+  {
     $protoId = 0;
     $result = $this->readUByte($protoId);
     if ($protoId != TCompactProtocol::PROTOCOL_ID) {
@@ -393,26 +452,32 @@ class TCompactProtocol extends TProtocol {
     return $result;
   }
 
-  public function readMessageEnd() {
+  public function readMessageEnd()
+  {
     return 0;
   }
 
-  public function readStructBegin(&$name) {
+  public function readStructBegin(&$name)
+  {
     $name = ''; // unused
     $this->structs[] = array($this->state, $this->lastFid);
     $this->state = TCompactProtocol::STATE_FIELD_READ;
     $this->lastFid = 0;
+
     return 0;
   }
 
-  public function readStructEnd() {
+  public function readStructEnd()
+  {
     $last = array_pop($this->structs);
     $this->state = $last[0];
     $this->lastFid = $last[1];
+
     return 0;
   }
 
-  public function readCollectionBegin(&$type, &$size) {
+  public function readCollectionBegin(&$type, &$size)
+  {
     $sizeType = 0;
     $result = $this->readUByte($sizeType);
     $size = $sizeType >> 4;
@@ -426,7 +491,8 @@ class TCompactProtocol extends TProtocol {
     return $result;
   }
 
-  public function readMapBegin(&$key_type, &$val_type, &$size) {
+  public function readMapBegin(&$key_type, &$val_type, &$size)
+  {
     $result = $this->readVarint($size);
     $types = 0;
     if ($size > 0) {
@@ -440,68 +506,84 @@ class TCompactProtocol extends TProtocol {
     return $result;
   }
 
-  public function readCollectionEnd() {
+  public function readCollectionEnd()
+  {
     $this->state = array_pop($this->containers);
+
     return 0;
   }
 
-  public function readMapEnd() {
+  public function readMapEnd()
+  {
     return $this->readCollectionEnd();
   }
 
-  public function readListBegin(&$elem_type, &$size) {
+  public function readListBegin(&$elem_type, &$size)
+  {
     return $this->readCollectionBegin($elem_type, $size);
   }
 
-  public function readListEnd() {
+  public function readListEnd()
+  {
     return $this->readCollectionEnd();
   }
 
-  public function readSetBegin(&$elem_type, &$size) {
+  public function readSetBegin(&$elem_type, &$size)
+  {
     return $this->readCollectionBegin($elem_type, $size);
   }
 
-  public function readSetEnd() {
+  public function readSetEnd()
+  {
     return $this->readCollectionEnd();
   }
 
-  public function readBool(&$value) {
+  public function readBool(&$value)
+  {
     if ($this->state == TCompactProtocol::STATE_BOOL_READ) {
       $value = $this->boolValue;
+
       return 0;
-    } else if ($this->state == TCompactProtocol::STATE_CONTAINER_READ) {
+    } elseif ($this->state == TCompactProtocol::STATE_CONTAINER_READ) {
       return $this->readByte($value);
     } else {
       throw new TProtocolException('Invalid state in compact protocol');
     }
   }
 
-  public function readI16(&$value) {
+  public function readI16(&$value)
+  {
     return $this->readZigZag($value);
   }
 
-  public function readI32(&$value) {
+  public function readI32(&$value)
+  {
     return $this->readZigZag($value);
   }
 
-  public function readDouble(&$value) {
+  public function readDouble(&$value)
+  {
     $data = $this->trans_->readAll(8);
     $arr = unpack('d', $data);
     $value = $arr[1];
+
     return 8;
   }
 
-  public function readString(&$value) {
+  public function readString(&$value)
+  {
     $result = $this->readVarint($len);
     if ($len) {
       $value = $this->trans_->readAll($len);
     } else {
       $value = '';
     }
+
     return $result + $len;
   }
 
-  public function getTType($byte) {
+  public function getTType($byte)
+  {
     return self::$ttypes[$byte & 0x0f];
   }
 
@@ -511,7 +593,8 @@ class TCompactProtocol extends TProtocol {
 
   // Read and write I64 as two 32 bit numbers $hi and $lo
 
-  public function readI64(&$value) {
+  public function readI64(&$value)
+  {
     // Read varint from wire
     $hi = 0;
     $lo = 0;
@@ -531,7 +614,7 @@ class TCompactProtocol extends TProtocol {
       // Shift hi and lo together.
       if ($shift >= 32) {
         $hi |= (($byte & 0x7f) << ($shift - 32));
-      } else if ($shift > 25) {
+      } elseif ($shift > 25) {
         $hi |= (($byte & 0x7f) >> ($shift - 25));
       }
       if (($byte >> 7) === 0) {
@@ -556,10 +639,10 @@ class TCompactProtocol extends TProtocol {
 
       // Check for a negative
       if ($isNeg) {
-        $hi = ~$hi & (int)0xffffffff;
-        $lo = ~$lo & (int)0xffffffff;
+        $hi = ~$hi & (int) 0xffffffff;
+        $lo = ~$lo & (int) 0xffffffff;
 
-        if ($lo == (int)0xffffffff) {
+        if ($lo == (int) 0xffffffff) {
           $hi++;
           $lo = 0;
         } else {
@@ -570,13 +653,13 @@ class TCompactProtocol extends TProtocol {
       // Force 32bit words in excess of 2G to be positive - we deal with sign
       // explicitly below
 
-      if ($hi & (int)0x80000000) {
-        $hi &= (int)0x7fffffff;
+      if ($hi & (int) 0x80000000) {
+        $hi &= (int) 0x7fffffff;
         $hi += 0x80000000;
       }
 
-      if ($lo & (int)0x80000000) {
-        $lo &= (int)0x7fffffff;
+      if ($lo & (int) 0x80000000) {
+        $lo &= (int) 0x7fffffff;
         $lo += 0x80000000;
       }
 
@@ -606,7 +689,8 @@ class TCompactProtocol extends TProtocol {
     return $idx;
   }
 
-  public function writeI64($value) {
+  public function writeI64($value)
+  {
     // If we are in an I32 range, use the easy method below.
     if (($value > 4294967296) || ($value < -4294967296)) {
       // Convert $value to $hi and $lo
@@ -616,13 +700,13 @@ class TCompactProtocol extends TProtocol {
         $value *= -1;
       }
 
-      $hi = (int)$value >> 32;
-      $lo = (int)$value & 0xffffffff;
+      $hi = (int) $value >> 32;
+      $lo = (int) $value & 0xffffffff;
 
       if ($neg) {
         $hi = ~$hi;
         $lo = ~$lo;
-        if (($lo & (int)0xffffffff) == (int)0xffffffff) {
+        if (($lo & (int) 0xffffffff) == (int) 0xffffffff) {
           $lo = 0;
           $hi++;
         } else {

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TJSONProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TJSONProtocol.php b/lib/php/lib/Thrift/Protocol/TJSONProtocol.php
index 402401a..6c93b09 100644
--- a/lib/php/lib/Thrift/Protocol/TJSONProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TJSONProtocol.php
@@ -23,7 +23,6 @@
 
 namespace Thrift\Protocol;
 
-use Thrift\Protocol\TProtocol;
 use Thrift\Type\TType;
 use Thrift\Exception\TProtocolException;
 use Thrift\Protocol\JSON\BaseContext;
@@ -142,8 +141,7 @@ class TJSONProtocol extends TProtocol
                 case 's':
                     if (substr($name, 1, 1) == 't') {
                         $result = TType::STRING;
-                    }
-                    else if (substr($name, 1, 1) == 'e') {
+                    } elseif (substr($name, 1, 1) == 'e') {
                         $result = TType::SET;
                     }
                     break;
@@ -155,6 +153,7 @@ class TJSONProtocol extends TProtocol
         if ($result == TType::STOP) {
             throw new TProtocolException("Unrecognized type", TProtocolException::INVALID_DATA);
         }
+
         return $result;
     }
 
@@ -162,22 +161,26 @@ class TJSONProtocol extends TProtocol
     public $context_;
     public $reader_;
 
-    private function pushContext($c) {
+    private function pushContext($c)
+    {
         array_push($this->contextStack_, $this->context_);
         $this->context_ = $c;
     }
 
-    private function popContext() {
+    private function popContext()
+    {
         $this->context_ = array_pop($this->contextStack_);
     }
 
-    public function __construct($trans) {
+    public function __construct($trans)
+    {
         parent::__construct($trans);
         $this->context_ = new BaseContext();
         $this->reader_ = new LookaheadReader($this);
     }
 
-    public function reset() {
+    public function reset()
+    {
         $this->contextStack_ = array();
         $this->context_ = new BaseContext();
         $this->reader_ = new LookaheadReader($this);
@@ -185,7 +188,8 @@ class TJSONProtocol extends TProtocol
 
     private $tmpbuf_ = array(4);
 
-    public function readJSONSyntaxChar($b) {
+    public function readJSONSyntaxChar($b)
+    {
         $ch = $this->reader_->read();
 
         if (substr($ch, 0, 1) != $b) {
@@ -193,7 +197,8 @@ class TJSONProtocol extends TProtocol
         }
     }
 
-    private function hexVal($s) {
+    private function hexVal($s)
+    {
         for ($i = 0; $i < strlen($s); $i++) {
             $ch = substr($s, $i, 1);
 
@@ -205,11 +210,13 @@ class TJSONProtocol extends TProtocol
         return hexdec($s);
     }
 
-    private function hexChar($val) {
+    private function hexChar($val)
+    {
         return dechex($val);
     }
 
-    private function writeJSONString($b) {
+    private function writeJSONString($b)
+    {
         $this->context_->write();
 
         if (is_numeric($b) && $this->context_->escapeNum()) {
@@ -223,7 +230,8 @@ class TJSONProtocol extends TProtocol
         }
     }
 
-    private function writeJSONInteger($num) {
+    private function writeJSONInteger($num)
+    {
         $this->context_->write();
 
         if ($this->context_->escapeNum()) {
@@ -237,7 +245,8 @@ class TJSONProtocol extends TProtocol
         }
     }
 
-    private function writeJSONDouble($num) {
+    private function writeJSONDouble($num)
+    {
         $this->context_->write();
 
         if ($this->context_->escapeNum()) {
@@ -251,42 +260,48 @@ class TJSONProtocol extends TProtocol
         }
     }
 
-    private function writeJSONBase64($data) {
+    private function writeJSONBase64($data)
+    {
         $this->context_->write();
         $this->trans_->write(self::QUOTE);
         $this->trans_->write(json_encode(base64_encode($data)));
         $this->trans_->write(self::QUOTE);
     }
 
-    private function writeJSONObjectStart() {
+    private function writeJSONObjectStart()
+    {
       $this->context_->write();
       $this->trans_->write(self::LBRACE);
       $this->pushContext(new PairContext($this));
     }
 
-    private function writeJSONObjectEnd() {
+    private function writeJSONObjectEnd()
+    {
       $this->popContext();
       $this->trans_->write(self::RBRACE);
     }
 
-    private function writeJSONArrayStart() {
+    private function writeJSONArrayStart()
+    {
       $this->context_->write();
       $this->trans_->write(self::LBRACKET);
       $this->pushContext(new ListContext($this));
     }
 
-    private function writeJSONArrayEnd() {
+    private function writeJSONArrayEnd()
+    {
       $this->popContext();
       $this->trans_->write(self::RBRACKET);
     }
 
-    private function readJSONString($skipContext) {
+    private function readJSONString($skipContext)
+    {
       if (!$skipContext) {
         $this->context_->read();
       }
 
       $jsonString = '';
-      $lastChar = NULL;
+      $lastChar = null;
       while (true) {
         $ch = $this->reader_->read();
         $jsonString .= $ch;
@@ -301,10 +316,12 @@ class TJSONProtocol extends TProtocol
           $lastChar = $ch;
         }
       }
+
       return json_decode($jsonString);
     }
 
-    private function isJSONNumeric($b) {
+    private function isJSONNumeric($b)
+    {
         switch ($b) {
             case '+':
             case '-':
@@ -323,10 +340,12 @@ class TJSONProtocol extends TProtocol
             case 'e':
               return true;
             }
+
         return false;
     }
 
-    private function readJSONNumericChars() {
+    private function readJSONNumericChars()
+    {
         $strbld = array();
 
         while (true) {
@@ -342,7 +361,8 @@ class TJSONProtocol extends TProtocol
         return implode("", $strbld);
     }
 
-    private function readJSONInteger() {
+    private function readJSONInteger()
+    {
         $this->context_->read();
 
         if ($this->context_->escapeNum()) {
@@ -368,7 +388,8 @@ class TJSONProtocol extends TProtocol
      * separate function?  So we don't have to force the rest of the
      * use cases through the extra conditional.
      */
-    private function readJSONIntegerAsString() {
+    private function readJSONIntegerAsString()
+    {
         $this->context_->read();
 
         if ($this->context_->escapeNum()) {
@@ -388,7 +409,8 @@ class TJSONProtocol extends TProtocol
         return $str;
     }
 
-    private function readJSONDouble() {
+    private function readJSONDouble()
+    {
         $this->context_->read();
 
         if (substr($this->reader_->peek(), 0, 1) == self::QUOTE) {
@@ -396,9 +418,9 @@ class TJSONProtocol extends TProtocol
 
             if ($arr == "NaN") {
                 return NAN;
-            } else if ($arr == "Infinity") {
+            } elseif ($arr == "Infinity") {
                 return INF;
-            } else if (!$this->context_->escapeNum()) {
+            } elseif (!$this->context_->escapeNum()) {
                 throw new TProtocolException("Numeric data unexpectedly quoted " . $arr,
                                               TProtocolException::INVALID_DATA);
             }
@@ -413,7 +435,8 @@ class TJSONProtocol extends TProtocol
         }
     }
 
-    private function readJSONBase64() {
+    private function readJSONBase64()
+    {
         $arr = $this->readJSONString(false);
         $data = base64_decode($arr, true);
 
@@ -424,13 +447,15 @@ class TJSONProtocol extends TProtocol
         return $data;
     }
 
-    private function readJSONObjectStart() {
+    private function readJSONObjectStart()
+    {
         $this->context_->read();
         $this->readJSONSyntaxChar(self::LBRACE);
         $this->pushContext(new PairContext($this));
     }
 
-    private function readJSONObjectEnd() {
+    private function readJSONObjectEnd()
+    {
         $this->readJSONSyntaxChar(self::RBRACE);
         $this->popContext();
     }
@@ -442,7 +467,8 @@ class TJSONProtocol extends TProtocol
         $this->pushContext(new ListContext($this));
     }
 
-    private function readJSONArrayEnd() {
+    private function readJSONArrayEnd()
+    {
         $this->readJSONSyntaxChar(self::RBRACKET);
         $this->popContext();
     }
@@ -450,11 +476,12 @@ class TJSONProtocol extends TProtocol
     /**
      * Writes the message header
      *
-     * @param string $name Function name
-     * @param int $type message type TMessageType::CALL or TMessageType::REPLY
-     * @param int $seqid The sequence id of this message
+     * @param string $name  Function name
+     * @param int    $type  message type TMessageType::CALL or TMessageType::REPLY
+     * @param int    $seqid The sequence id of this message
      */
-    public function writeMessageBegin($name, $type, $seqid) {
+    public function writeMessageBegin($name, $type, $seqid)
+    {
         $this->writeJSONArrayStart();
         $this->writeJSONInteger(self::VERSION);
         $this->writeJSONString($name);
@@ -465,18 +492,20 @@ class TJSONProtocol extends TProtocol
     /**
      * Close the message
      */
-    public function writeMessageEnd() {
+    public function writeMessageEnd()
+    {
         $this->writeJSONArrayEnd();
     }
 
     /**
      * Writes a struct header.
      *
-     * @param string     $name Struct name
+     * @param  string     $name Struct name
      * @throws TException on write error
-     * @return int How many bytes written
+     * @return int        How many bytes written
      */
-    public function writeStructBegin($name) {
+    public function writeStructBegin($name)
+    {
         $this->writeJSONObjectStart();
     }
 
@@ -484,26 +513,31 @@ class TJSONProtocol extends TProtocol
      * Close a struct.
      *
      * @throws TException on write error
-     * @return int How many bytes written
+     * @return int        How many bytes written
      */
-    public function writeStructEnd() {
+    public function writeStructEnd()
+    {
         $this->writeJSONObjectEnd();
     }
 
-    public function writeFieldBegin($fieldName, $fieldType, $fieldId) {
+    public function writeFieldBegin($fieldName, $fieldType, $fieldId)
+    {
         $this->writeJSONInteger($fieldId);
         $this->writeJSONObjectStart();
         $this->writeJSONString($this->getTypeNameForTypeID($fieldType));
     }
 
-    public function writeFieldEnd() {
+    public function writeFieldEnd()
+    {
         $this->writeJsonObjectEnd();
     }
 
-    public function writeFieldStop() {
+    public function writeFieldStop()
+    {
     }
 
-    public function writeMapBegin($keyType, $valType, $size) {
+    public function writeMapBegin($keyType, $valType, $size)
+    {
         $this->writeJSONArrayStart();
         $this->writeJSONString($this->getTypeNameForTypeID($keyType));
         $this->writeJSONString($this->getTypeNameForTypeID($valType));
@@ -511,56 +545,68 @@ class TJSONProtocol extends TProtocol
         $this->writeJSONObjectStart();
     }
 
-    public function writeMapEnd() {
+    public function writeMapEnd()
+    {
         $this->writeJSONObjectEnd();
         $this->writeJSONArrayEnd();
     }
 
-    public function writeListBegin($elemType, $size) {
+    public function writeListBegin($elemType, $size)
+    {
         $this->writeJSONArrayStart();
         $this->writeJSONString($this->getTypeNameForTypeID($elemType));
         $this->writeJSONInteger($size);
     }
 
-    public function writeListEnd() {
+    public function writeListEnd()
+    {
         $this->writeJSONArrayEnd();
     }
 
-    public function writeSetBegin($elemType, $size) {
+    public function writeSetBegin($elemType, $size)
+    {
         $this->writeJSONArrayStart();
         $this->writeJSONString($this->getTypeNameForTypeID($elemType));
         $this->writeJSONInteger($size);
     }
 
-    public function writeSetEnd() {
+    public function writeSetEnd()
+    {
         $this->writeJSONArrayEnd();
     }
 
-    public function writeBool($bool) {
+    public function writeBool($bool)
+    {
         $this->writeJSONInteger($bool ? 1 : 0);
     }
 
-    public function writeByte($byte) {
+    public function writeByte($byte)
+    {
         $this->writeJSONInteger($byte);
     }
 
-    public function writeI16($i16) {
+    public function writeI16($i16)
+    {
         $this->writeJSONInteger($i16);
     }
 
-    public function writeI32($i32) {
+    public function writeI32($i32)
+    {
         $this->writeJSONInteger($i32);
     }
 
-    public function writeI64($i64) {
+    public function writeI64($i64)
+    {
         $this->writeJSONInteger($i64);
     }
 
-    public function writeDouble($dub) {
+    public function writeDouble($dub)
+    {
         $this->writeJSONDouble($dub);
     }
 
-    public function writeString($str) {
+    public function writeString($str)
+    {
         $this->writeJSONString($str);
     }
 
@@ -568,10 +614,11 @@ class TJSONProtocol extends TProtocol
      * Reads the message header
      *
      * @param string $name Function name
-     * @param int $type message type TMessageType::CALL or TMessageType::REPLY
+     * @param int    $type message type TMessageType::CALL or TMessageType::REPLY
      * @parem int $seqid The sequence id of this message
      */
-    public function readMessageBegin(&$name, &$type, &$seqid) {
+    public function readMessageBegin(&$name, &$type, &$seqid)
+    {
         $this->readJSONArrayStart();
 
         if ($this->readJSONInteger() != self::VERSION) {
@@ -588,20 +635,25 @@ class TJSONProtocol extends TProtocol
     /**
      * Read the close of message
      */
-    public function readMessageEnd() {
+    public function readMessageEnd()
+    {
         $this->readJSONArrayEnd();
     }
 
-    public function readStructBegin(&$name) {
+    public function readStructBegin(&$name)
+    {
         $this->readJSONObjectStart();
+
         return 0;
     }
 
-    public function readStructEnd() {
+    public function readStructEnd()
+    {
         $this->readJSONObjectEnd();
     }
 
-    public function readFieldBegin(&$name, &$fieldType, &$fieldId) {
+    public function readFieldBegin(&$name, &$fieldType, &$fieldId)
+    {
         $ch = $this->reader_->peek();
         $name = "";
 
@@ -614,11 +666,13 @@ class TJSONProtocol extends TProtocol
         }
     }
 
-    public function readFieldEnd() {
+    public function readFieldEnd()
+    {
         $this->readJSONObjectEnd();
     }
 
-    public function readMapBegin(&$keyType, &$valType, &$size) {
+    public function readMapBegin(&$keyType, &$valType, &$size)
+    {
         $this->readJSONArrayStart();
         $keyType = $this->getTypeIDForTypeName($this->readJSONString(false));
         $valType = $this->getTypeIDForTypeName($this->readJSONString(false));
@@ -626,69 +680,90 @@ class TJSONProtocol extends TProtocol
         $this->readJSONObjectStart();
     }
 
-    public function readMapEnd() {
+    public function readMapEnd()
+    {
         $this->readJSONObjectEnd();
         $this->readJSONArrayEnd();
     }
 
-    public function readListBegin(&$elemType, &$size) {
+    public function readListBegin(&$elemType, &$size)
+    {
         $this->readJSONArrayStart();
         $elemType = $this->getTypeIDForTypeName($this->readJSONString(false));
         $size = $this->readJSONInteger();
+
         return true;
     }
 
-    public function readListEnd() {
+    public function readListEnd()
+    {
         $this->readJSONArrayEnd();
     }
 
-    public function readSetBegin(&$elemType, &$size) {
+    public function readSetBegin(&$elemType, &$size)
+    {
         $this->readJSONArrayStart();
         $elemType = $this->getTypeIDForTypeName($this->readJSONString(false));
         $size = $this->readJSONInteger();
+
         return true;
     }
 
-    public function readSetEnd() {
+    public function readSetEnd()
+    {
         $this->readJSONArrayEnd();
     }
 
-    public function readBool(&$bool) {
+    public function readBool(&$bool)
+    {
         $bool = $this->readJSONInteger() == 0 ? false : true;
+
         return true;
     }
 
-    public function readByte(&$byte) {
+    public function readByte(&$byte)
+    {
         $byte = $this->readJSONInteger();
+
         return true;
     }
 
-    public function readI16(&$i16) {
+    public function readI16(&$i16)
+    {
         $i16 = $this->readJSONInteger();
+
         return true;
     }
 
-    public function readI32(&$i32) {
+    public function readI32(&$i32)
+    {
         $i32 = $this->readJSONInteger();
+
         return true;
     }
 
-    public function readI64(&$i64) {
-        if ( PHP_INT_SIZE === 4 ) {
+    public function readI64(&$i64)
+    {
+        if (PHP_INT_SIZE === 4) {
             $i64 = $this->readJSONIntegerAsString();
         } else {
             $i64 = $this->readJSONInteger();
         }
+
         return true;
     }
 
-    public function readDouble(&$dub) {
+    public function readDouble(&$dub)
+    {
         $dub = $this->readJSONDouble();
+
         return true;
     }
 
-    public function readString(&$str) {
+    public function readString(&$str)
+    {
         $str = $this->readJSONString(false);
+
         return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TMultiplexedProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TMultiplexedProtocol.php b/lib/php/lib/Thrift/Protocol/TMultiplexedProtocol.php
index 50f869f..d579c09 100644
--- a/lib/php/lib/Thrift/Protocol/TMultiplexedProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TMultiplexedProtocol.php
@@ -83,4 +83,3 @@ class TMultiplexedProtocol extends TProtocolDecorator
         }
     }
 }
- 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TProtocol.php b/lib/php/lib/Thrift/Protocol/TProtocol.php
index 380ff10..0e3bc0d 100644
--- a/lib/php/lib/Thrift/Protocol/TProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TProtocol.php
@@ -28,8 +28,8 @@ use Thrift\Exception\TProtocolException;
 /**
  * Protocol base class module.
  */
-abstract class TProtocol {
-
+abstract class TProtocol
+{
   /**
    * Underlying transport
    *
@@ -40,7 +40,8 @@ abstract class TProtocol {
   /**
    * Constructor
    */
-  protected function __construct($trans) {
+  protected function __construct($trans)
+  {
     $this->trans_ = $trans;
   }
 
@@ -49,7 +50,8 @@ abstract class TProtocol {
    *
    * @return TTransport
    */
-  public function getTransport() {
+  public function getTransport()
+  {
     return $this->trans_;
   }
 
@@ -60,12 +62,12 @@ abstract class TProtocol {
    * @param int $type message type TMessageType::CALL or TMessageType::REPLY
    * @param int $seqid The sequence id of this message
    */
-  public abstract function writeMessageBegin($name, $type, $seqid);
+  abstract public function writeMessageBegin($name, $type, $seqid);
 
   /**
    * Close the message
    */
-  public abstract function writeMessageEnd();
+  abstract public function writeMessageEnd();
 
   /**
    * Writes a struct header.
@@ -74,7 +76,7 @@ abstract class TProtocol {
    * @throws TException on write error
    * @return int How many bytes written
    */
-  public abstract function writeStructBegin($name);
+  abstract public function writeStructBegin($name);
 
   /**
    * Close a struct.
@@ -82,7 +84,7 @@ abstract class TProtocol {
    * @throws TException on write error
    * @return int How many bytes written
    */
-  public abstract function writeStructEnd();
+  abstract public function writeStructEnd();
 
   /*
    * Starts a field.
@@ -93,37 +95,37 @@ abstract class TProtocol {
    * @throws TException on write error
    * @return int How many bytes written
    */
-  public abstract function writeFieldBegin($fieldName, $fieldType, $fieldId);
+  abstract public function writeFieldBegin($fieldName, $fieldType, $fieldId);
 
-  public abstract function writeFieldEnd();
+  abstract public function writeFieldEnd();
 
-  public abstract function writeFieldStop();
+  abstract public function writeFieldStop();
 
-  public abstract function writeMapBegin($keyType, $valType, $size);
+  abstract public function writeMapBegin($keyType, $valType, $size);
 
-  public abstract function writeMapEnd();
+  abstract public function writeMapEnd();
 
-  public abstract function writeListBegin($elemType, $size);
+  abstract public function writeListBegin($elemType, $size);
 
-  public abstract function writeListEnd();
+  abstract public function writeListEnd();
 
-  public abstract function writeSetBegin($elemType, $size);
+  abstract public function writeSetBegin($elemType, $size);
 
-  public abstract function writeSetEnd();
+  abstract public function writeSetEnd();
 
-  public abstract function writeBool($bool);
+  abstract public function writeBool($bool);
 
-  public abstract function writeByte($byte);
+  abstract public function writeByte($byte);
 
-  public abstract function writeI16($i16);
+  abstract public function writeI16($i16);
 
-  public abstract function writeI32($i32);
+  abstract public function writeI32($i32);
 
-  public abstract function writeI64($i64);
+  abstract public function writeI64($i64);
 
-  public abstract function writeDouble($dub);
+  abstract public function writeDouble($dub);
 
-  public abstract function writeString($str);
+  abstract public function writeString($str);
 
   /**
    * Reads the message header
@@ -132,46 +134,46 @@ abstract class TProtocol {
    * @param int $type message type TMessageType::CALL or TMessageType::REPLY
    * @parem int $seqid The sequence id of this message
    */
-  public abstract function readMessageBegin(&$name, &$type, &$seqid);
+  abstract public function readMessageBegin(&$name, &$type, &$seqid);
 
   /**
    * Read the close of message
    */
-  public abstract function readMessageEnd();
+  abstract public function readMessageEnd();
 
-  public abstract function readStructBegin(&$name);
+  abstract public function readStructBegin(&$name);
 
-  public abstract function readStructEnd();
+  abstract public function readStructEnd();
 
-  public abstract function readFieldBegin(&$name, &$fieldType, &$fieldId);
+  abstract public function readFieldBegin(&$name, &$fieldType, &$fieldId);
 
-  public abstract function readFieldEnd();
+  abstract public function readFieldEnd();
 
-  public abstract function readMapBegin(&$keyType, &$valType, &$size);
+  abstract public function readMapBegin(&$keyType, &$valType, &$size);
 
-  public abstract function readMapEnd();
+  abstract public function readMapEnd();
 
-  public abstract function readListBegin(&$elemType, &$size);
+  abstract public function readListBegin(&$elemType, &$size);
 
-  public abstract function readListEnd();
+  abstract public function readListEnd();
 
-  public abstract function readSetBegin(&$elemType, &$size);
+  abstract public function readSetBegin(&$elemType, &$size);
 
-  public abstract function readSetEnd();
+  abstract public function readSetEnd();
 
-  public abstract function readBool(&$bool);
+  abstract public function readBool(&$bool);
 
-  public abstract function readByte(&$byte);
+  abstract public function readByte(&$byte);
 
-  public abstract function readI16(&$i16);
+  abstract public function readI16(&$i16);
 
-  public abstract function readI32(&$i32);
+  abstract public function readI32(&$i32);
 
-  public abstract function readI64(&$i64);
+  abstract public function readI64(&$i64);
 
-  public abstract function readDouble(&$dub);
+  abstract public function readDouble(&$dub);
 
-  public abstract function readString(&$str);
+  abstract public function readString(&$str);
 
   /**
    * The skip function is a utility to parse over unrecognized date without
@@ -179,7 +181,8 @@ abstract class TProtocol {
    *
    * @param TType $type What type is it
    */
-  public function skip($type) {
+  public function skip($type)
+  {
     switch ($type) {
     case TType::BOOL:
       return $this->readBool($bool);
@@ -207,6 +210,7 @@ abstract class TProtocol {
           $result += $this->readFieldEnd();
         }
         $result += $this->readStructEnd();
+
         return $result;
       }
     case TType::MAP:
@@ -217,6 +221,7 @@ abstract class TProtocol {
           $result += $this->skip($valType);
         }
         $result += $this->readMapEnd();
+
         return $result;
       }
     case TType::SET:
@@ -226,6 +231,7 @@ abstract class TProtocol {
           $result += $this->skip($elemType);
         }
         $result += $this->readSetEnd();
+
         return $result;
       }
     case TType::LST:
@@ -235,6 +241,7 @@ abstract class TProtocol {
           $result += $this->skip($elemType);
         }
         $result += $this->readListEnd();
+
         return $result;
       }
     default:
@@ -249,7 +256,8 @@ abstract class TProtocol {
    * @param TTransport $itrans TTransport object
    * @param int        $type   Field type
    */
-  public static function skipBinary($itrans, $type) {
+  public static function skipBinary($itrans, $type)
+  {
     switch ($type) {
     case TType::BOOL:
       return $itrans->readAll(1);
@@ -269,6 +277,7 @@ abstract class TProtocol {
       if ($len > 0x7fffffff) {
         $len = 0 - (($len - 1) ^ 0xffffffff);
       }
+
       return 4 + $itrans->readAll($len);
     case TType::STRUCT:
       {
@@ -286,6 +295,7 @@ abstract class TProtocol {
           $result += $itrans->readAll(2);
           $result += self::skipBinary($itrans, $ftype);
         }
+
         return $result;
       }
     case TType::MAP:
@@ -310,6 +320,7 @@ abstract class TProtocol {
           $result += self::skipBinary($itrans, $ktype);
           $result += self::skipBinary($itrans, $vtype);
         }
+
         return $result;
       }
     case TType::SET:
@@ -330,6 +341,7 @@ abstract class TProtocol {
         for ($i = 0; $i < $size; $i++) {
           $result += self::skipBinary($itrans, $vtype);
         }
+
         return $result;
       }
     default:

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Protocol/TProtocolDecorator.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TProtocolDecorator.php b/lib/php/lib/Thrift/Protocol/TProtocolDecorator.php
index 4f1746c..c08c4d5 100644
--- a/lib/php/lib/Thrift/Protocol/TProtocolDecorator.php
+++ b/lib/php/lib/Thrift/Protocol/TProtocolDecorator.php
@@ -79,7 +79,7 @@ abstract class TProtocolDecorator extends TProtocol
      * @param string $name Struct name
      *
      * @throws TException on write error
-     * @return int How many bytes written
+     * @return int        How many bytes written
      */
     public function writeStructBegin($name)
     {
@@ -90,7 +90,7 @@ abstract class TProtocolDecorator extends TProtocol
      * Close a struct.
      *
      * @throws TException on write error
-     * @return int How many bytes written
+     * @return int        How many bytes written
      */
     public function writeStructEnd()
     {

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Serializer/TBinarySerializer.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Serializer/TBinarySerializer.php b/lib/php/lib/Thrift/Serializer/TBinarySerializer.php
index 4e0af87..7e0cf8b 100644
--- a/lib/php/lib/Thrift/Serializer/TBinarySerializer.php
+++ b/lib/php/lib/Thrift/Serializer/TBinarySerializer.php
@@ -31,14 +31,15 @@ use Thrift\Type\TMessageType;
  * Utility class for serializing and deserializing
  * a thrift object using TBinaryProtocolAccelerated.
  */
-class TBinarySerializer {
-
+class TBinarySerializer
+{
   // NOTE(rmarin): Because thrift_protocol_write_binary
   // adds a begin message prefix, you cannot specify
   // a transport in which to serialize an object. It has to
   // be a string. Otherwise we will break the compatibility with
   // normal deserialization.
-  public static function serialize($object) {
+  public static function serialize($object)
+  {
     $transport = new TMemoryBuffer();
     $protocol = new TBinaryProtocolAccelerated($transport);
     if (function_exists('thrift_protocol_write_binary')) {
@@ -52,10 +53,12 @@ class TBinarySerializer {
       $object->write($protocol);
     }
     $protocol->getTransport()->flush();
+
     return $transport->getBuffer();
   }
 
-  public static function deserialize($string_object, $class_name) {
+  public static function deserialize($string_object, $class_name)
+  {
      $transport = new TMemoryBuffer();
      $protocol = new TBinaryProtocolAccelerated($transport);
      if (function_exists('thrift_protocol_read_binary')) {
@@ -67,12 +70,14 @@ class TBinarySerializer {
        $protocolTransport = $protocol->getTransport();
        $protocolTransport->write($string_object);
        $protocolTransport->flush();
+
        return thrift_protocol_read_binary($protocol, $class_name,
                                           $protocol->isStrictRead());
      } else {
        $transport->write($string_object);
        $object = new $class_name();
        $object->read($protocol);
+
        return $object;
      }
   }

http://git-wip-us.apache.org/repos/asf/thrift/blob/6fb59237/lib/php/lib/Thrift/Server/TForkingServer.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Server/TForkingServer.php b/lib/php/lib/Thrift/Server/TForkingServer.php
index 6fca305..7f6e541 100644
--- a/lib/php/lib/Thrift/Server/TForkingServer.php
+++ b/lib/php/lib/Thrift/Server/TForkingServer.php
@@ -2,7 +2,6 @@
 
 namespace Thrift\Server;
 
-use Thrift\Server\TServer;
 use Thrift\Transport\TTransport;
 use Thrift\Exception\TException;
 use Thrift\Exception\TTransportException;
@@ -12,7 +11,8 @@ use Thrift\Exception\TTransportException;
  *
  * @package thrift.server
  */
-class TForkingServer extends TServer {
+class TForkingServer extends TServer
+{
   /**
    * Flag for the main serving loop
    *
@@ -34,7 +34,8 @@ class TForkingServer extends TServer {
    *
    * @return void
    */
-  public function serve() {
+  public function serve()
+  {
     $this->transport_->listen();
 
     while (!$this->stop_) {
@@ -46,16 +47,13 @@ class TForkingServer extends TServer {
 
           if ($pid > 0) {
             $this->handleParent($transport, $pid);
-          }
-          else if ($pid === 0) {
+          } elseif ($pid === 0) {
             $this->handleChild($transport);
-          }
-          else {
+          } else {
             throw new TException('Failed to fork');
           }
         }
-      }
-      catch (TTransportException $e) { }
+      } catch (TTransportException $e) { }
 
       $this->collectChildren();
     }
@@ -68,7 +66,8 @@ class TForkingServer extends TServer {
    * @param int $pid
    * @return void
    */
-  private function handleParent(TTransport $transport, $pid) {
+  private function handleParent(TTransport $transport, $pid)
+  {
     $this->children_[$pid] = $transport;
   }
 
@@ -78,7 +77,8 @@ class TForkingServer extends TServer {
    * @param TTransport $transport
    * @return void
    */
-  private function handleChild(TTransport $transport) {
+  private function handleChild(TTransport $transport)
+  {
     try {
       $inputTransport = $this->inputTransportFactory_->getTransport($transport);
       $outputTransport = $this->outputTransportFactory_->getTransport($transport);
@@ -86,8 +86,7 @@ class TForkingServer extends TServer {
       $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport);
       while ($this->processor_->process($inputProtocol, $outputProtocol)) { }
       @$transport->close();
-    }
-    catch (TTransportException $e) { }
+    } catch (TTransportException $e) { }
 
     exit(0);
   }
@@ -97,7 +96,8 @@ class TForkingServer extends TServer {
    *
    * @return void
    */
-  private function collectChildren() {
+  private function collectChildren()
+  {
     foreach ($this->children_ as $pid => $transport) {
       if (pcntl_waitpid($pid, $status, WNOHANG) > 0) {
         unset($this->children_[$pid]);
@@ -112,7 +112,8 @@ class TForkingServer extends TServer {
    *
    * @return void
    */
-  public function stop() {
+  public function stop()
+  {
     $this->transport_->close();
     $this->stop_ = true;
   }