Skip to content

Commit a1dd4e1

Browse files
fix(phpstan): reviewed codebase and dropped treatPhpDocTypesAsCertain: false setting
1 parent ef14e42 commit a1dd4e1

File tree

4 files changed

+3
-14
lines changed

4 files changed

+3
-14
lines changed

.github/linters/phpstan.neon

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
parameters:
22
level: 8
3-
treatPhpDocTypesAsCertain: false
4-
#phpVersion: 80100
5-
#treatPhpDocTypesAsCertain: false
63
fileExtensions:
74
- php
85
- module

src/CNR/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function request($cmd = [])
9595
] + $this->curlopts);
9696

9797
// which is by default tested for by phpStan
98-
/** @var string $r */
98+
/** @var string|false $r */
9999
$r = curl_exec($curl);
100100
$error = null;
101101
if ($r === false) {

src/HEXONET/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public function request($cmd)
460460
] + $this->curlopts);
461461

462462
// which is by default tested for by phpStan
463-
/** @var string $r */
463+
/** @var string|false $r */
464464
$r = curl_exec($curl);
465465
$error = null;
466466
if ($r === false) {

src/HEXONET/ResponseTranslator.php

+1-9
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public static function translate($raw, $cmd, $ph = [])
7575
// Missing CODE or DESCRIPTION in API Response
7676
if (
7777
(
78-
$newraw === null
79-
|| !preg_match("/description[\s]*=/i", $newraw) // missing description
78+
!preg_match("/description[\s]*=/i", $newraw) // missing description
8079
|| preg_match("/description[\s]*=\r\n/i", $newraw) // empty description
8180
|| !preg_match("/code[\s]*=/i", $newraw) // missing code
8281
)
@@ -156,15 +155,8 @@ protected static function findMatch($regex, &$newraw, $val, $cmd, $ph)
156155
// Generic replacing of placeholder vars
157156
if (preg_match("/\{[^}]+\}/", $newraw)) {
158157
foreach ($ph as $key => $val) {
159-
if ($newraw === null) {
160-
continue;
161-
}
162158
$newraw = preg_replace("/\{" . preg_quote($key, "/") . "\}/", $val, $newraw) ?? $newraw;
163159
}
164-
if ($newraw === null) {
165-
return $return;
166-
}
167-
168160
$newraw = preg_replace("/\{[^}]+\}/", "", $newraw) ?? $newraw;
169161
$return = true;
170162
}

0 commit comments

Comments
 (0)