Skip to content

Commit

Permalink
Fix: preg_match(): Argument #2 ($subject) must be of type string, boo…
Browse files Browse the repository at this point in the history
…l given
  • Loading branch information
blankse authored and dvesh3 committed Jul 19, 2023
1 parent e6d716e commit 5526a49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions models/DataObject/ClassDefinition/Data.php
Expand Up @@ -1166,12 +1166,13 @@ public function getFilterCode()

$dataParamDoc = 'mixed $data';
$reflectionMethod = new \ReflectionMethod($this, 'addListingFilter');
if (preg_match('/@param\s+([^\s]+)\s+\$data(.*)/', $reflectionMethod->getDocComment(), $dataParam)) {
$docComment = $reflectionMethod->getDocComment();
if ($docComment && preg_match('/@param\s+([^\s]+)\s+\$data(.*)/', $docComment, $dataParam)) {
$dataParamDoc = $dataParam[1].' $data '.$dataParam[2];
}

$operatorParamDoc = 'string $operator SQL comparison operator, e.g. =, <, >= etc. You can use "?" as placeholder, e.g. "IN (?)"';
if (preg_match('/@param\s+([^\s]+)\s+\$operator(.*)/', $reflectionMethod->getDocComment(), $dataParam)) {
if ($docComment && preg_match('/@param\s+([^\s]+)\s+\$operator(.*)/', $docComment, $dataParam)) {
$operatorParamDoc = $dataParam[1].' $operator '.$dataParam[2];
}

Expand Down

0 comments on commit 5526a49

Please sign in to comment.