aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2015-10-27 08:59:31 -0700
committerGravatar Stanley Cheung <stanleycheung@google.com>2015-10-27 08:59:31 -0700
commita5fd9d1455ad4b68d8113904acbbf62ef8776cdc (patch)
tree999c471538d150371438fe9a2ef7132edb2798a5 /src/php/lib
parentdcd35b8ad63624b956897c1e8ede67b0e0f81a16 (diff)
php: fix inconsistent array notation
Diffstat (limited to 'src/php/lib')
-rwxr-xr-xsrc/php/lib/Grpc/BaseStub.php16
-rw-r--r--src/php/lib/Grpc/BidiStreamingCall.php4
-rw-r--r--src/php/lib/Grpc/ClientStreamingCall.php6
-rw-r--r--src/php/lib/Grpc/ServerStreamingCall.php2
-rw-r--r--src/php/lib/Grpc/UnaryCall.php4
5 files changed, 16 insertions, 16 deletions
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index 5614314598..16153e8e99 100755
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -152,7 +152,7 @@ class BaseStub {
$timeout = $metadata['timeout'];
unset($metadata_copy['timeout']);
}
- return array($metadata_copy, $timeout);
+ return [$metadata_copy, $timeout];
}
/**
@@ -162,7 +162,7 @@ class BaseStub {
* @throw InvalidArgumentException if key contains invalid characters
*/
private function _validate_and_normalize_metadata($metadata) {
- $metadata_copy = array();
+ $metadata_copy = [];
foreach ($metadata as $key => $value) {
if (!preg_match('/^[A-Za-z\d_-]+$/', $key)) {
throw new \InvalidArgumentException(
@@ -189,8 +189,8 @@ class BaseStub {
public function _simpleRequest($method,
$argument,
callable $deserialize,
- $metadata = array(),
- $options = array()) {
+ $metadata = [],
+ $options = []) {
list($actual_metadata, $timeout) = $this->_extract_timeout_from_metadata($metadata);
$call = new UnaryCall($this->channel, $method, $deserialize, $timeout);
$jwt_aud_uri = $this->_get_jwt_aud_uri($method);
@@ -217,7 +217,7 @@ class BaseStub {
*/
public function _clientStreamRequest($method,
callable $deserialize,
- $metadata = array()) {
+ $metadata = []) {
list($actual_metadata, $timeout) = $this->_extract_timeout_from_metadata($metadata);
$call = new ClientStreamingCall($this->channel, $method, $deserialize, $timeout);
$jwt_aud_uri = $this->_get_jwt_aud_uri($method);
@@ -244,8 +244,8 @@ class BaseStub {
public function _serverStreamRequest($method,
$argument,
callable $deserialize,
- $metadata = array(),
- $options = array()) {
+ $metadata = [],
+ $options = []) {
list($actual_metadata, $timeout) = $this->_extract_timeout_from_metadata($metadata);
$call = new ServerStreamingCall($this->channel, $method, $deserialize, $timeout);
$jwt_aud_uri = $this->_get_jwt_aud_uri($method);
@@ -269,7 +269,7 @@ class BaseStub {
*/
public function _bidiRequest($method,
callable $deserialize,
- $metadata = array()) {
+ $metadata = []) {
list($actual_metadata, $timeout) = $this->_extract_timeout_from_metadata($metadata);
$call = new BidiStreamingCall($this->channel, $method, $deserialize, $timeout);
$jwt_aud_uri = $this->_get_jwt_aud_uri($method);
diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php
index c432fd52d8..60c0fb0f82 100644
--- a/src/php/lib/Grpc/BidiStreamingCall.php
+++ b/src/php/lib/Grpc/BidiStreamingCall.php
@@ -42,7 +42,7 @@ class BidiStreamingCall extends AbstractCall {
* Start the call
* @param array $metadata Metadata to send with the call, if applicable
*/
- public function start($metadata = array()) {
+ public function start($metadata = []) {
$this->call->startBatch([OP_SEND_INITIAL_METADATA => $metadata]);
}
@@ -69,7 +69,7 @@ class BidiStreamingCall extends AbstractCall {
* @param array $options an array of options, possible keys:
* 'flags' => a number
*/
- public function write($data, $options = array()) {
+ public function write($data, $options = []) {
$message_array = ['message' => $data->serialize()];
if (isset($options['flags'])) {
$message_array['flags'] = $options['flags'];
diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php
index b96c17e751..55c4aa49d6 100644
--- a/src/php/lib/Grpc/ClientStreamingCall.php
+++ b/src/php/lib/Grpc/ClientStreamingCall.php
@@ -42,7 +42,7 @@ class ClientStreamingCall extends AbstractCall {
* Start the call.
* @param array $metadata Metadata to send with the call, if applicable
*/
- public function start($metadata = array()) {
+ public function start($metadata = []) {
$this->call->startBatch([OP_SEND_INITIAL_METADATA => $metadata]);
}
@@ -53,7 +53,7 @@ class ClientStreamingCall extends AbstractCall {
* @param array $options an array of options, possible keys:
* 'flags' => a number
*/
- public function write($data, $options = array()) {
+ public function write($data, $options = []) {
$message_array = ['message' => $data->serialize()];
if (isset($options['flags'])) {
$message_array['flags'] = $options['flags'];
@@ -72,6 +72,6 @@ class ClientStreamingCall extends AbstractCall {
OP_RECV_MESSAGE => true,
OP_RECV_STATUS_ON_CLIENT => true]);
$this->metadata = $event->metadata;
- return array($this->deserializeResponse($event->message), $event->status);
+ return [$this->deserializeResponse($event->message), $event->status];
}
} \ No newline at end of file
diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php
index a93c1a5d5e..f18ad2c22a 100644
--- a/src/php/lib/Grpc/ServerStreamingCall.php
+++ b/src/php/lib/Grpc/ServerStreamingCall.php
@@ -45,7 +45,7 @@ class ServerStreamingCall extends AbstractCall {
* @param array $options an array of options, possible keys:
* 'flags' => a number
*/
- public function start($data, $metadata = array(), $options = array()) {
+ public function start($data, $metadata = [], $options = []) {
$message_array = ['message' => $data->serialize()];
if (isset($options['flags'])) {
$message_array['flags'] = $options['flags'];
diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php
index 38af6b1d74..821c31013f 100644
--- a/src/php/lib/Grpc/UnaryCall.php
+++ b/src/php/lib/Grpc/UnaryCall.php
@@ -45,7 +45,7 @@ class UnaryCall extends AbstractCall {
* @param array $options an array of options, possible keys:
* 'flags' => a number
*/
- public function start($data, $metadata = array(), $options = array()) {
+ public function start($data, $metadata = [], $options = []) {
$message_array = ['message' => $data->serialize()];
if (isset($options['flags'])) {
$message_array['flags'] = $options['flags'];
@@ -66,6 +66,6 @@ class UnaryCall extends AbstractCall {
$event = $this->call->startBatch([
OP_RECV_MESSAGE => true,
OP_RECV_STATUS_ON_CLIENT => true]);
- return array($this->deserializeResponse($event->message), $event->status);
+ return [$this->deserializeResponse($event->message), $event->status];
}
}