Skip to content

Commit

Permalink
Fixes curly braces deprecation notices for PHP 7.4 (#6)
Browse files Browse the repository at this point in the history
* Fixes curly braces deprecation notices for PHP 7.4 (see https://wiki.php.net/rfc/deprecate_curly_braces_array_access)
* Adds PHP 7.4 to test targets for Travis CI
* Fixes wrong property access
  • Loading branch information
offdev authored and tPl0ch committed Dec 12, 2019
1 parent 6694500 commit f031a4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ php:
- '7.1'
- '7.2'
- '7.3'
- '7.4'

before_script:
- composer self-update
Expand Down
8 changes: 4 additions & 4 deletions lib/avro/protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function real_parse($avro) {
if (!is_null($avro["messages"])) {
foreach ($avro["messages"] as $messageName => $messageAvro) {
$message = new AvroProtocolMessage($messageName, $messageAvro, $this);
$this->messages{$messageName} = $message;
$this->messages[$messageName] = $message;
}
}
}
Expand Down Expand Up @@ -91,12 +91,12 @@ class AvroProtocolMessage
public function __construct($name, $avro, $protocol)
{
$this->name = $name;
$this->request = new AvroRecordSchema(new AvroName($name, null, $protocol->namespace), null, $avro{'request'}, $protocol->schemata, AvroSchema::REQUEST_SCHEMA);
$this->request = new AvroRecordSchema(new AvroName($name, null, $protocol->namespace), null, $avro['request'], $protocol->schemata, AvroSchema::REQUEST_SCHEMA);

if (array_key_exists('response', $avro)) {
$this->response = $protocol->schemata->schema_by_name(new AvroName($avro{'response'}, $protocol->namespace, $protocol->namespace));
$this->response = $protocol->schemata->schema_by_name(new AvroName($avro['response'], $protocol->namespace, $protocol->namespace));
if ($this->response == null)
$this->response = new AvroPrimitiveSchema($avro{'response'});
$this->response = new AvroPrimitiveSchema($avro['response']);
}
}
}
Expand Down

0 comments on commit f031a4d

Please sign in to comment.