Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/AbstractMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class AbstractMessage implements Message
* @param \Protobuf\Stream|resource|string $stream
* @param \Protobuf\Configuration $configuration
*/
public function __construct($stream = null, \Protobuf\Configuration $configuration = null)
public function __construct(?$stream = null, ?\Protobuf\Configuration $configuration = null)
{
if ($stream === null) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/Binary/StreamWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(Configuration $config)
* @param string $bytes
* @param int $length
*/
public function writeBytes(Stream $stream, $bytes, $length = null)
public function writeBytes(Stream $stream, $bytes, ?$length = null)
{
if ($length === null) {
$length = mb_strlen($bytes, '8bit');
Expand Down Expand Up @@ -290,7 +290,7 @@ public function writeByteStream(Stream $stream, Stream $value)
* @param \Protobuf\Stream $value
* @param int $length
*/
public function writeStream(Stream $stream, Stream $value, $length = null)
public function writeStream(Stream $stream, Stream $value, ?$length = null)
{
if ($length === null) {
$length = $value->getSize();
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/ExtensionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ExtensionField
* @param callback $sizeCalculator
* @param string $method
*/
public function __construct($extendee, $name, $tag, $reader, $writer, $sizeCalculator, $method = null)
public function __construct($extendee, $name, $tag, $reader, $writer, $sizeCalculator, ?$method = null)
{
$this->tag = $tag;
$this->name = $name;
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/ExtensionFieldMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ExtensionFieldMap extends SplObjectStorage implements Collection
/**
* @param string $extendee
*/
public function __construct($extendee = null)
public function __construct(?$extendee = null)
{
$this->extendee = trim($extendee, '\\');
}
Expand Down
4 changes: 2 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface Message
*
* @return \Protobuf\Message
*/
public static function fromStream($stream, Configuration $configuration = null);
public static function fromStream($stream, Configuration ?$configuration = null);

/**
* Serializes the message and returns a stream containing its bytes.
Expand All @@ -31,7 +31,7 @@ public static function fromStream($stream, Configuration $configuration = null);
*
* @return \Protobuf\Stream
*/
public function toStream(Configuration $configuration = null);
public function toStream(Configuration ?$configuration = null);

/**
* Compute the number of bytes that would be needed to encode the message
Expand Down
2 changes: 1 addition & 1 deletion src/MessageSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MessageSerializer implements Serializer
/**
* @param \Protobuf\Configuration $config
*/
public function __construct(Configuration $config = null)
public function __construct(Configuration ?$config = null)
{
$this->config = $config ?: Configuration::getInstance();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReadContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ReadContext
* @param \Protobuf\Binary\StreamReader $reader
* @param \Protobuf\Extension\ExtensionRegistry $extensionRegistry
*/
public function __construct($stream, StreamReader $reader, ExtensionRegistry $extensionRegistry = null)
public function __construct($stream, StreamReader $reader, ExtensionRegistry ?$extensionRegistry = null)
{
if ( ! $stream instanceof \Protobuf\Stream) {
$stream = Stream::wrap($stream);
Expand Down
6 changes: 3 additions & 3 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Stream
*
* @throws \InvalidArgumentException if the stream is not a stream resource
*/
public function __construct($stream, $size = null)
public function __construct($stream, ?$size = null)
{
if ( ! is_resource($stream)) {
throw new InvalidArgumentException('Stream must be a resource');
Expand Down Expand Up @@ -253,7 +253,7 @@ public function writeStream(Stream $stream, $length)
*
* @throws \InvalidArgumentException if the $resource arg is not valid.
*/
public static function wrap($resource = '', $size = null)
public static function wrap($resource = '', ?$size = null)
{
if ($resource instanceof Stream) {
return $resource;
Expand Down Expand Up @@ -290,7 +290,7 @@ public static function create()
*
* @return \Protobuf\Stream
*/
public static function fromString($resource = '', $size = null)
public static function fromString($resource = '', ?$size = null)
{
$stream = fopen('php://temp', 'r+');

Expand Down
2 changes: 1 addition & 1 deletion src/Unknown.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Unknown
* @param integer $type
* @param mixed $value
*/
public function __construct($tag = 0, $type = null, $value = null)
public function __construct($tag = 0, $type = null, ?$value = null)
{
$this->tag = $tag;
$this->type = $type;
Expand Down