Skip to content

Commit 35e386c

Browse files
committed
Favour isset() over array_key_exists().
1 parent a8ab844 commit 35e386c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ExtEventLoop.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function removeStream($stream)
9292
{
9393
$key = (int) $stream;
9494

95-
if (!array_key_exists($key, $this->streamEvents)) {
95+
if (!isset($this->streamEvents[$key])) {
9696
return;
9797
}
9898

@@ -250,7 +250,7 @@ protected function addStreamEvent($stream, $flag, $listener)
250250
{
251251
$key = (int) $stream;
252252

253-
if (array_key_exists($key, $this->streamEvents)) {
253+
if (isset($this->streamEvents[$key])) {
254254
$entry = $this->streamEvents[$key];
255255
} else {
256256
$entry = new stdClass;
@@ -298,7 +298,7 @@ protected function removeStreamEvent($stream, $flag)
298298
{
299299
$key = (int) $stream;
300300

301-
if (!array_key_exists($key, $this->streamEvents)) {
301+
if (!isset($this->streamEvents[$key])) {
302302
return;
303303
}
304304

StreamSelectNextTickLoop.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function addReadStream($stream, $listener)
3434
{
3535
$key = (int) $stream;
3636

37-
if (!array_key_exists($key, $this->readStreams)) {
37+
if (!isset($this->readStreams[$key])) {
3838
$this->readStreams[$key] = $stream;
3939
$this->readListeners[$key] = $listener;
4040
}
@@ -50,7 +50,7 @@ public function addWriteStream($stream, $listener)
5050
{
5151
$key = (int) $stream;
5252

53-
if (!array_key_exists($key, $this->writeStreams)) {
53+
if (!isset($this->writeStreams[$key])) {
5454
$this->writeStreams[$key] = $stream;
5555
$this->writeListeners[$key] = $listener;
5656
}
@@ -209,7 +209,7 @@ protected function waitForStreamActivity($blocking)
209209
foreach ($read as $stream) {
210210
$key = (int) $stream;
211211

212-
if (array_key_exists($key, $this->readListeners)) {
212+
if (isset($this->readListeners[$key])) {
213213
call_user_func($this->readListeners[$key], $stream, $this);
214214
}
215215
}
@@ -218,7 +218,7 @@ protected function waitForStreamActivity($blocking)
218218
foreach ($write as $stream) {
219219
$key = (int) $stream;
220220

221-
if (array_key_exists($key, $this->writeListeners)) {
221+
if (isset($this->writeListeners[$key])) {
222222
call_user_func($this->writeListeners[$key], $stream, $this);
223223
}
224224
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy