Skip to content

Commit

Permalink
Fix up PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Feb 15, 2023
1 parent 2cafd98 commit 60e53ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 7
level: 8
paths:
- src/
bootstrapFiles:
Expand Down
18 changes: 9 additions & 9 deletions src/View/Helper/MetaHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function icon($value = null) {
$value = null;
}

return $this->Html->meta('icon', $value);
return (string)$this->Html->meta('icon', $value);
}

/**
Expand All @@ -199,7 +199,7 @@ public function sizesIcon($url, $size, array $options = []) {
return '';
}
if ($value === true) {
$value = null;
$value = $options;
}

$options = [
Expand Down Expand Up @@ -237,7 +237,7 @@ public function language($value = null) {
'content' => $language,
];

return $this->Html->meta($array);
return (string)$this->Html->meta($array);
}

/**
Expand Down Expand Up @@ -267,7 +267,7 @@ public function robots($value = null) {
$robots = implode(',', $robots);
}

return $this->Html->meta('robots', $robots);
return (string)$this->Html->meta('robots', $robots);
}

/**
Expand Down Expand Up @@ -324,7 +324,7 @@ public function description($description = null, $lang = null) {
'lang' => $lang !== '*' ? $lang : null,
];

return $this->Html->meta($array);
return (string)$this->Html->meta($array);
}

/**
Expand Down Expand Up @@ -385,7 +385,7 @@ public function keywords($keywords = null, $lang = null) {
'lang' => $lang !== '*' ? $lang : null,
];

return $this->Html->meta($array);
return (string)$this->Html->meta($array);
}

/**
Expand Down Expand Up @@ -422,7 +422,7 @@ public function custom($name = null, $value = null) {
'content' => $value,
];

return $this->Html->meta($array);
return (string)$this->Html->meta($array);
}

/**
Expand Down Expand Up @@ -494,7 +494,7 @@ public function httpEquiv($type = null, $value = null) {
'content' => $value,
];

return $this->Html->meta($array);
return (string)$this->Html->meta($array);
}

/**
Expand Down Expand Up @@ -576,7 +576,7 @@ public function out($header = null, $options = []) {
$meta['property'] = $header;
}

return $this->Html->meta($meta);
return (string)$this->Html->meta($meta);
}

$results = [];
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/View/Helper/MetaHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ public function testOut() {
<link rel="canonical" href="/"/>
<meta http-equiv="language" content="de"/>
<meta name="robots" content="index,nofollow,noarchive"/>
<meta name="keywords" content="foo bar" lang="de"/><meta name="keywords" content="foo bar EN" lang="en"/>
<meta name="description" content="A sentence" lang="de"/>
<meta name="keywords" content="foo bar" lang="de"/><meta name="keywords" content="foo bar EN" lang="en"/>
<meta name="http-equiv" content="0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="x" content="y"/>';
$this->assertTextEquals($expected, $result);
Expand All @@ -364,8 +364,8 @@ public function testOutMultiLanguageFalse() {
<link href="/favicon.ico" type="image/x-icon" rel="icon"/><link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
<meta http-equiv="language" content="de"/>
<meta name="robots" content="noindex,nofollow,noarchive"/>
<meta name="keywords" content="foo bar" lang="de"/>
<meta name="description" content="A sentence" lang="de"/>';
<meta name="description" content="A sentence" lang="de"/>
<meta name="keywords" content="foo bar" lang="de"/>';
$this->assertTextEquals($expected, $result);

$this->Meta->language('en');
Expand All @@ -380,8 +380,8 @@ public function testOutMultiLanguageFalse() {
<link href="/favicon.ico" type="image/x-icon" rel="icon"/><link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
<meta http-equiv="language" content="en"/>
<meta name="robots" content="noindex,nofollow,noarchive"/>
<meta name="keywords" content="foo bar EN" lang="en"/>
<meta name="description" content="A sentence EN" lang="en"/>';
<meta name="description" content="A sentence EN" lang="en"/>
<meta name="keywords" content="foo bar EN" lang="en"/>';
$this->assertTextEquals($expected, $result);
}

Expand Down

0 comments on commit 60e53ad

Please sign in to comment.