Skip to content

Commit 69001aa

Browse files
Merge pull request #28 from Werelds/bugfix/array_key_exists-on-objects
[PHP 7.4 Compatibility] Replace array_key_exists with property_exists during response parsing
2 parents 94c0181 + 8cc00b6 commit 69001aa

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Replaced `array_key_exists` with `property_exists` for compatibility with
10+
PHP 7.3
811

912
## [1.1.1] - 2020-10-02
1013
### Changed

src/PushNotifications.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct($options, $client = null) {
2525
$this->options = $options;
2626
if (!is_array($this->options)) {
2727
throw new \Exception("Options parameter must be an array");
28-
}
28+
}
2929
if ($client == null) {
3030
$this->client = new GuzzleHTTP\Client();
3131
} else {
@@ -92,8 +92,8 @@ private function makeRequest($method, $path, $pathParams, $body = null) {
9292
$badJSON = $parsedResponse == null;
9393
if (
9494
$badJSON ||
95-
!ARRAY_KEY_EXISTS('error', $parsedResponse) ||
96-
!ARRAY_KEY_EXISTS('description', $parsedResponse)
95+
!property_exists($parsedResponse, 'error') ||
96+
!property_exists($parsedResponse, 'description')
9797
) {
9898
throw new \Exception("An unexpected server error has occurred");
9999
}

0 commit comments

Comments
 (0)