Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/php/lib/Exception/TApplicationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace Thrift\Exception;

use Thrift\Protocol\TProtocol;
use Thrift\Type\TType;

class TApplicationException extends TException
Expand Down Expand Up @@ -53,17 +54,17 @@ class TApplicationException extends TException
public const INVALID_PROTOCOL = 9;
public const UNSUPPORTED_CLIENT_TYPE = 10;

public function __construct($message = null, $code = 0)
public function __construct(?string $message = null, int $code = 0)
{
parent::__construct($message, $code);
}

public function read($output)
public function read(TProtocol $input): int
{
return $this->readStruct('TApplicationException', self::$tspec, $output);
return $this->readStruct('TApplicationException', self::$tspec, $input);
}

public function write($output)
public function write(TProtocol $output): int
{
$xfer = 0;
$xfer += $output->writeStructBegin('TApplicationException');
Expand Down
8 changes: 4 additions & 4 deletions lib/php/lib/Exception/TException.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
* Can be called with standard Exception constructor (message, code) or with
* Thrift Base object constructor (spec, vals).
*
* @param mixed $p1 Message (string) or type-spec (array)
* @param mixed $p2 Code (integer) or values (array)
* @param string|array|null $p1 Message (string) or type-spec (array)
* @param int|array $p2 Code (integer) or values (array)
*/
#[\AllowDynamicProperties]
class TException extends \Exception
{
public function __construct($p1 = null, $p2 = 0)
public function __construct(string|array|null $p1 = null, int|array $p2 = 0)
{
if (is_array($p1) && is_array($p2)) {
$spec = $p1;
Expand All @@ -56,7 +56,7 @@ public function __construct($p1 = null, $p2 = 0)
}
}
} else {
parent::__construct((string)$p1, $p2);
parent::__construct($p1 ?? '', $p2);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/php/lib/Exception/TProtocolException.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TProtocolException extends TException
public const NOT_IMPLEMENTED = 5;
public const DEPTH_LIMIT = 6;

public function __construct($message = null, $code = 0)
public function __construct(?string $message = null, int $code = 0)
{
parent::__construct($message, $code);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/php/lib/Exception/TTransportException.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TTransportException extends TException
public const TIMED_OUT = 3;
public const END_OF_FILE = 4;

public function __construct($message = null, $code = 0)
public function __construct(?string $message = null, int $code = 0)
{
parent::__construct($message, $code);
}
Expand Down
Loading