Skip to content

Commit

Permalink
Merge pull request #4712 from nworr/phpstan-1-11
Browse files Browse the repository at this point in the history
Fix phpstan error detected sinc phpstan 1.11
  • Loading branch information
rldhont authored Aug 28, 2024
2 parents dbbe820 + 88a737e commit 8ae1c87
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lizmap/modules/dataviz/classes/datavizPlot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public function fetchData($method = 'wfs', $exp_filter = '')
$matches = array();
$preg = preg_match_all('#"\b[^\s]+\b"#', $exp_filter, $matches);
$pp = '';
if (count($matches) > 0 and count($matches[0]) > 0) {
if ($preg != false && count($matches[0]) > 0) {
foreach ($matches[0] as $m) {
$pp .= ','.trim($m, '"');
}
Expand Down
8 changes: 4 additions & 4 deletions lizmap/modules/lizmap/classes/qgisExpressionUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public static function getCriteriaFromExpression($exp)
if ($exp === null || trim($exp) === '') {
return array();
}
preg_match_all('/"([^"]+)"/', $exp, $matches);
if (count($matches) < 2) {
$preg = preg_match_all('/"([^"]+)"/', $exp, $matches);
if ($preg == false) {
return array();
}

Expand Down Expand Up @@ -59,8 +59,8 @@ public static function getCriteriaFromExpressions($expressions)
*/
public static function getCurrentValueCriteriaFromExpression($exp)
{
preg_match_all('/\\bcurrent_value\\(\\s*\'([^)]*)\'\\s*\\)/', $exp, $matches);
if (count($matches) == 2) {
$preg = preg_match_all('/\\bcurrent_value\\(\\s*\'([^)]*)\'\\s*\\)/', $exp, $matches);
if ($preg !== false) {
return array_values(array_unique($matches[1]));
}

Expand Down
6 changes: 2 additions & 4 deletions lizmap/modules/lizmap/lib/Request/WMSRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,8 @@ protected function process_getcapabilities()
if (!preg_match('@Service>.*?Max'.$d.'.*?</Service@si', $data)) {
$matches = array();
if (preg_match('@Service>(.*?)</Service@si', $data, $matches)) {
if (count($matches) > 1) {
$sUpdate = $matches[1].'<Max'.$d.'>3000</Max'.$d.">\n ";
$data = str_replace($matches[1], $sUpdate, $data);
}
$sUpdate = $matches[1].'<Max'.$d.'>3000</Max'.$d.">\n ";
$data = str_replace($matches[1], $sUpdate, $data);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/units/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"require": {
"php": ">=7.3.0",
"phpunit/phpunit": "^9.5.7",
"phpstan/phpstan": "1.11.*"
"phpstan/phpstan": "^1.10.1"
},
"autoload": {
"classmap": ["../../lizmap/modules/lizmap/classes/" ],
Expand Down

0 comments on commit 8ae1c87

Please sign in to comment.