Skip to content

Commit aa5867f

Browse files
authored
Refactor domain validation logic in ValidateDomainSniff
Do not allow current domain name to be empty. Notify the user with an error
1 parent 03f9805 commit aa5867f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

WPForms/Sniffs/PHP/ValidateDomainSniff.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,19 @@ public function process( File $phpcsFile, $stackPtr ) {
113113
return;
114114
}
115115

116-
if ( ! $currentDomain || ! $expectedDomain ) {
116+
if ( ! $currentDomain ) {
117+
$phpcsFile->addError(
118+
sprintf(
119+
"Domain name is not set. You should be using '%s'.",
120+
$expectedDomain
121+
),
122+
$stackPtr,
123+
'InvalidDomain'
124+
);
125+
return;
126+
}
127+
128+
if ( ! $expectedDomain ) {
117129
return;
118130
}
119131

0 commit comments

Comments
 (0)