Removed all instances of == and != in PHP code

pull/346/head
murgatroid99 10 years ago
parent 26b18f09b9
commit 25e5f67bb9
  1. 2
      src/php/lib/Grpc/AbstractSurfaceActiveCall.php
  2. 7
      src/php/lib/Grpc/ActiveCall.php
  3. 2
      src/php/lib/Grpc/ServerStreamingSurfaceActiveCall.php
  4. 34
      src/php/tests/interop/interop_client.php

@ -44,7 +44,7 @@ abstract class AbstractSurfaceActiveCall {
protected function _read() {
$response = $this->active_call->read();
if ($response == null) {
if ($response === null) {
return null;
}
return call_user_func($this->deserialize, $response);

@ -66,12 +66,7 @@ class ActiveCall {
* @param ByteBuffer $data The data to write
*/
public function write($data) {
if($this->call->start_write($data,
WRITE_ACCEPTED,
$this->flags) != OP_OK) {
// TODO(mlumish): more useful error
throw new \Exception("Cannot call write after writesDone");
}
$this->call->start_write($data, WRITE_ACCEPTED, $this->flags);
$this->completion_queue->pluck(WRITE_ACCEPTED, Timeval::inf_future());
}

@ -31,7 +31,7 @@ class ServerStreamingSurfaceActiveCall extends AbstractSurfaceActiveCall {
* @return An iterator of response values
*/
public function responses() {
while(($response = $this->_read()) != null) {
while(($response = $this->_read()) !== null) {
yield $response;
}
}

@ -26,8 +26,8 @@ function hardAssert($value, $error_message) {
*/
function emptyUnary($stub) {
list($result, $status) = $stub->EmptyCall(new grpc\testing\EmptyMessage())->wait();
hardAssert($status->code == Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result != null, 'Call completed with a null response');
hardAssert($status->code === Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result !== null, 'Call completed with a null response');
}
/**
@ -49,14 +49,14 @@ function largeUnary($stub) {
$request->setPayload($payload);
list($result, $status) = $stub->UnaryCall($request)->wait();
hardAssert($status->code == Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result != null, 'Call returned a null response');
hardAssert($status->code === Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result !== null, 'Call returned a null response');
$payload = $result->getPayload();
hardAssert($payload->getType() == grpc\testing\PayloadType::COMPRESSABLE,
hardAssert($payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
'Payload had the wrong type');
hardAssert(strlen($payload->getBody()) == $response_len,
hardAssert(strlen($payload->getBody()) === $response_len,
'Payload had the wrong length');
hardAssert($payload->getBody() == str_repeat("\0", $response_len),
hardAssert($payload->getBody() === str_repeat("\0", $response_len),
'Payload had the wrong content');
}
@ -78,8 +78,8 @@ function clientStreaming($stub) {
}, $request_lengths);
list($result, $status) = $stub->StreamingInputCall($requests)->wait();
hardAssert($status->code == Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result->getAggregatedPayloadSize() == 74922,
hardAssert($status->code === Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result->getAggregatedPayloadSize() === 74922,
'aggregated_payload_size was incorrect');
}
@ -100,15 +100,15 @@ function serverStreaming($stub) {
}
$call = $stub->StreamingOutputCall($request);
hardAssert($call->getStatus()->code == Grpc\STATUS_OK,
hardAssert($call->getStatus()->code === Grpc\STATUS_OK,
'Call did not complete successfully');
$i = 0;
foreach($call->responses() as $value) {
hardAssert($i < 4, 'Too many responses');
$payload = $value->getPayload();
hardAssert($payload->getType() == grpc\testing\PayloadType::COMPRESSABLE,
hardAssert($payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
'Payload ' . $i . ' had the wrong type');
hardAssert(strlen($payload->getBody()) == $sizes[$i],
hardAssert(strlen($payload->getBody()) === $sizes[$i],
'Response ' . $i . ' had the wrong length');
}
}
@ -136,16 +136,16 @@ function pingPong($stub) {
$call->write($request);
$response = $call->read();
hardAssert($response != null, 'Server returned too few responses');
hardAssert($response !== null, 'Server returned too few responses');
$payload = $response->getPayload();
hardAssert($payload->getType() == grpc\testing\PayloadType::COMPRESSABLE,
hardAssert($payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
'Payload ' . $i . ' had the wrong type');
hardAssert(strlen($payload->getBody()) == $response_lengths[$i],
hardAssert(strlen($payload->getBody()) === $response_lengths[$i],
'Payload ' . $i . ' had the wrong length');
}
$call->writesDone();
hardAssert($call->read() == null, 'Server returned too many responses');
hardAssert($call->getStatus()->code == Grpc\STATUS_OK,
hardAssert($call->read() === null, 'Server returned too many responses');
hardAssert($call->getStatus()->code === Grpc\STATUS_OK,
'Call did not complete successfully');
}

Loading…
Cancel
Save