Skip to content

Commit 0730eda

Browse files
committed
Use boolean values in while loops
1 parent 5ff6ed1 commit 0730eda

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Driver/SQLSrv/Result.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function free(): void
106106
// @link http://php.net/manual/en/pdostatement.closecursor.php
107107
// @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075
108108
// deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them
109-
while (sqlsrv_fetch($this->statement)) {
109+
while (sqlsrv_fetch($this->statement) === true) {
110110
}
111111
}
112112

src/Schema/SQLServerSchemaManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column
156156

157157
private function parseDefaultExpression(string $value): ?string
158158
{
159-
while (preg_match('/^\((.*)\)$/s', $value, $matches)) {
159+
while (preg_match('/^\((.*)\)$/s', $value, $matches) === 1) {
160160
$value = $matches[1];
161161
}
162162

tests/Functional/Driver/OCI8/ResultTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testTruncatedFetch(
100100
}
101101

102102
try {
103-
while ($result->fetchOne()) {
103+
while ($result->fetchOne() !== false) {
104104
// Attempt to access all remaining rows from the original fetch
105105
// The rows locally cached from the default prefetch will first be used
106106
// but when the result attempts to get the remaining 10 rows beyond

tests/Functional/PortabilityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ public function testFullFetchMode(): void
3636

3737
$result = $this->connection->executeQuery('SELECT * FROM portability_table');
3838

39-
while (($row = $result->fetchAssociative())) {
39+
while (($row = $result->fetchAssociative()) !== false) {
4040
$this->assertFetchResultRow($row);
4141
}
4242

4343
$result = $this->connection
4444
->prepare('SELECT * FROM portability_table')
4545
->executeQuery();
4646

47-
while (($row = $result->fetchAssociative())) {
47+
while (($row = $result->fetchAssociative()) !== false) {
4848
$this->assertFetchResultRow($row);
4949
}
5050
}

0 commit comments

Comments
 (0)