Skip to content

Commit 0be6829

Browse files
authored
Merge pull request #127 from Codeception/fix-internal-domains
fix: check using isset instead of !== null for possibly non-existent …
2 parents 182edcf + e30e595 commit 0be6829

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

ecs.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
ForbiddenFunctionsSniff::class => [
5959
'tests/**',
6060
'console/**'
61-
]
61+
],
62+
'tests/_support/_generated'
6263
]);
6364

6465
// $ecsConfig->skip([

src/Codeception/Lib/Connector/Yii2.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,7 @@ public function getInternalDomains(): array
222222
$domains = [$this->getDomainRegex($urlManager->hostInfo)];
223223
if ($urlManager->enablePrettyUrl) {
224224
foreach ($urlManager->rules as $rule) {
225-
/**
226-
* @var \yii\web\UrlRule $rule
227-
*/
228-
if ($rule->host !== null) {
225+
if (isset($rule->host)) {
229226
$domains[] = $this->getDomainRegex($rule->host);
230227
}
231228
}

tests/Yii.stub

+8
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,12 @@ namespace yii\web {
9595
public function setScriptFile($path): void {}
9696
}
9797

98+
interface UrlRuleInterface{}
99+
class UrlManager {
100+
/**
101+
* @var UrlRuleInterface[] $rules;
102+
*/
103+
public array $rules = [];
104+
}
105+
98106
}

0 commit comments

Comments
 (0)