Skip to content

Commit

Permalink
Silence some php82 notices
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Feb 3, 2023
1 parent e4736a6 commit 6389e25
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"files": ["lib/constants.php"]
},
"require-dev": {
"phpunit/phpunit": "*"
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.32 || ^9.5.10"
}
}
14 changes: 7 additions & 7 deletions lib/Creator/AtomCreator10.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public function createFeed()
$feed .= " xml:lang=\"".$this->language."\"";
}
$feed .= ">\n";
$feed .= " <title>".htmlspecialchars($this->title)."</title>\n";
$feed .= " <title>".htmlspecialchars((string) $this->title)."</title>\n";
$feed .= " <subtitle>".htmlspecialchars($this->description)."</subtitle>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n";
$feed .= " <id>".htmlspecialchars($this->link)."</id>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars((string) $this->link)."\"/>\n";
$feed .= " <id>".htmlspecialchars((string) $this->link)."</id>\n";
$now = new FeedDate();
$feed .= " <updated>".htmlspecialchars($now->iso8601())."</updated>\n";
if ($this->editor != "") {
Expand All @@ -65,14 +65,14 @@ public function createFeed()
$feed .= " <generator>".$this->version()."</generator>\n";

$feed .= " <link rel=\"self\" type=\"application/atom+xml\" href=\"".htmlspecialchars(
$this->syndicationURL
(string) $this->syndicationURL
)."\" />\n";
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n";
$feed .= " <title>".htmlspecialchars(strip_tags((string) $this->items[$i]->title))."</title>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars(
$this->items[$i]->link
(string) $this->items[$i]->link
)."\"/>\n";
if ($this->items[$i]->date == "") {
$this->items[$i]->date = time();
Expand All @@ -86,7 +86,7 @@ public function createFeed()
$tempguid = $this->items[$i]->guid;
}

$feed .= " <id>".htmlspecialchars($tempguid)."</id>\n";
$feed .= " <id>".htmlspecialchars((string) $tempguid)."</id>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
Expand Down
1 change: 1 addition & 0 deletions lib/Creator/FeedCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ abstract class FeedCreator extends HtmlDescribable
*/
public $xslStyleSheet = "";

public $cssStyleSheet = "";

/** @var FeedItem[] */
public $items = Array();
Expand Down
6 changes: 3 additions & 3 deletions lib/Creator/RSSCreator091.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function createFeed()
} else {
$feed .= " <channel>\n";
}
$feed .= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->title), 100)."</title>\n";
$feed .= " <title>".FeedCreator::iTrunc(htmlspecialchars((string) $this->title), 100)."</title>\n";
$this->descriptionTruncSize = 500;
$feed .= " <description>".$this->getDescription()."</description>\n";
$feed .= " <link>".$this->link."</link>\n";
Expand Down Expand Up @@ -130,10 +130,10 @@ public function createFeed()
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <item>\n";
$feed .= " <title>".FeedCreator::iTrunc(
htmlspecialchars(strip_tags($this->items[$i]->title)),
htmlspecialchars(strip_tags((string) $this->items[$i]->title)),
100
)."</title>\n";
$feed .= " <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
$feed .= " <link>".htmlspecialchars((string) $this->items[$i]->link)."</link>\n";
$feed .= " <description>".$this->items[$i]->getDescription()."</description>\n";

$creator = $this->getAuthor($this->items[$i]->author, $this->items[$i]->authorEmail);
Expand Down
14 changes: 7 additions & 7 deletions lib/Creator/RSSCreator10.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function createFeed()
}
$feed .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$feed .= " <channel rdf:about=\"".$this->syndicationURL."\">\n";
$feed .= " <title>".htmlspecialchars($this->title)."</title>\n";
$feed .= " <description>".htmlspecialchars($this->description)."</description>\n";
$feed .= " <title>".htmlspecialchars((string) $this->title)."</title>\n";
$feed .= " <description>".htmlspecialchars((string) $this->description)."</description>\n";
$feed .= " <link>".$this->link."</link>\n";
if ($this->image != null) {
$feed .= " <image rdf:resource=\"".$this->image->url."\" />\n";
Expand All @@ -42,7 +42,7 @@ public function createFeed()
$feed .= " <items>\n";
$feed .= " <rdf:Seq>\n";
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <rdf:li rdf:resource=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n";
$feed .= " <rdf:li rdf:resource=\"".htmlspecialchars((string) $this->items[$i]->link)."\"/>\n";
}
$feed .= " </rdf:Seq>\n";
$feed .= " </items>\n";
Expand All @@ -57,7 +57,7 @@ public function createFeed()
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");

for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <item rdf:about=\"".htmlspecialchars($this->items[$i]->link)."\">\n";
$feed .= " <item rdf:about=\"".htmlspecialchars((string) $this->items[$i]->link)."\">\n";
$feed .= " <dc:format>text/html</dc:format>\n";
if ($this->items[$i]->date != null) {
$itemDate = new FeedDate($this->items[$i]->date);
Expand All @@ -77,10 +77,10 @@ public function createFeed()
$feed .= " <photo:thumbnail>".htmlspecialchars($this->items[$i]->thumb)."</photo:thumbnail>\n";
}
$feed .= " <title>".htmlspecialchars(
strip_tags(strtr($this->items[$i]->title, "\n\r", " "))
strip_tags(strtr((string) $this->items[$i]->title, "\n\r", " "))
)."</title>\n";
$feed .= " <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
$feed .= " <description>".htmlspecialchars($this->items[$i]->description)."</description>\n";
$feed .= " <link>".htmlspecialchars((string) $this->items[$i]->link)."</link>\n";
$feed .= " <description>".htmlspecialchars((string) $this->items[$i]->description)."</description>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
$feed .= " </item>\n";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/UniversalFeedCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class UniversalFeedCreator extends FeedCreator
*/
protected function _setFormat($format)
{
switch (strtoupper($format)) {
switch (strtoupper((string) $format)) {

case "BASE":
$this->format = $format;
Expand Down
2 changes: 1 addition & 1 deletion test/UniversalFeedCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function test_createFeed()
$this->assertEquals($expected->channel->description, $actual->channel->description);
}

public function provider_createFeed()
public static function provider_createFeed()
{
return array
(
Expand Down

0 comments on commit 6389e25

Please sign in to comment.