Skip to content

Commit

Permalink
Merge pull request #62 from gsteel/2.18.1-fix-createTextNode
Browse files Browse the repository at this point in the history
Fix strict_types errors in DOMDocument::createTextNode()
  • Loading branch information
Ocramius committed Aug 8, 2022
2 parents f2b852e + 7855d20 commit a57fdb9
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 170 deletions.
120 changes: 24 additions & 96 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2239,9 +2239,8 @@
</MixedMethodCall>
</file>
<file src="src/Writer/Extension/DublinCore/Renderer/Entry.php">
<MixedArgument occurrences="2">
<MixedArgument occurrences="1">
<code>$data</code>
<code>$data['name']</code>
</MixedArgument>
<MixedAssignment occurrences="2">
<code>$authors</code>
Expand All @@ -2255,9 +2254,8 @@
</TypeDoesNotContainType>
</file>
<file src="src/Writer/Extension/DublinCore/Renderer/Feed.php">
<MixedArgument occurrences="2">
<MixedArgument occurrences="1">
<code>$data</code>
<code>$data['name']</code>
</MixedArgument>
<MixedAssignment occurrences="2">
<code>$authors</code>
Expand Down Expand Up @@ -2309,11 +2307,6 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php">
<MixedArgument occurrences="3">
<code>$block</code>
<code>$description</code>
<code>$explicit</code>
</MixedArgument>
<MixedAssignment occurrences="3">
<code>$block</code>
<code>$description</code>
Expand All @@ -2326,12 +2319,8 @@
</MixedMethodCall>
</file>
<file src="src/Writer/Extension/GooglePlayPodcast/Renderer/Feed.php">
<MixedArgument occurrences="8">
<code>$author</code>
<code>$block</code>
<MixedArgument occurrences="4">
<code>$cat</code>
<code>$description</code>
<code>$explicit</code>
<code>$image</code>
<code>$key</code>
<code>$subcat</code>
Expand Down Expand Up @@ -2442,19 +2431,9 @@
</TypeDoesNotContainType>
</file>
<file src="src/Writer/Extension/ITunes/Renderer/Entry.php">
<MixedArgument occurrences="12">
<code>$author</code>
<code>$block</code>
<code>$duration</code>
<code>$episode</code>
<code>$explicit</code>
<MixedArgument occurrences="2">
<code>$image</code>
<code>$keywords</code>
<code>$season</code>
<code>$subtitle</code>
<code>$summary</code>
<code>$title</code>
<code>$type</code>
</MixedArgument>
<MixedAssignment occurrences="14">
<code>$author</code>
Expand Down Expand Up @@ -2493,22 +2472,12 @@
</TypeDoesNotContainType>
</file>
<file src="src/Writer/Extension/ITunes/Renderer/Feed.php">
<MixedArgument occurrences="15">
<code>$author</code>
<code>$block</code>
<MixedArgument occurrences="5">
<code>$cat</code>
<code>$duration</code>
<code>$explicit</code>
<code>$image</code>
<code>$key</code>
<code>$keywords</code>
<code>$owner['email']</code>
<code>$owner['name']</code>
<code>$subcat</code>
<code>$subtitle</code>
<code>$summary</code>
<code>$type</code>
<code>$url</code>
</MixedArgument>
<MixedArrayAccess occurrences="2">
<code>$owner['email']</code>
Expand Down Expand Up @@ -2576,12 +2545,19 @@
<code>getPodcastIndexSoundbites</code>
<code>getPodcastIndexTranscript</code>
</MixedMethodCall>
<RedundantCastGivenDocblockType occurrences="1">
<code>(string) $soundbite['title']</code>
</RedundantCastGivenDocblockType>
</file>
<file src="src/Writer/Extension/PodcastIndex/Renderer/Feed.php">
<MixedMethodCall occurrences="2">
<code>getPodcastIndexFunding</code>
<code>getPodcastIndexLocked</code>
</MixedMethodCall>
<RedundantCastGivenDocblockType occurrences="2">
<code>(string) $funding['title']</code>
<code>(string) $locked['value']</code>
</RedundantCastGivenDocblockType>
</file>
<file src="src/Writer/Extension/Slash/Renderer/Entry.php">
<MixedAssignment occurrences="1">
Expand Down Expand Up @@ -2624,9 +2600,6 @@
</TypeDoesNotContainType>
</file>
<file src="src/Writer/Extension/WellFormedWeb/Renderer/Entry.php">
<MixedArgument occurrences="1">
<code>$link['uri']</code>
</MixedArgument>
<MixedArrayAccess occurrences="2">
<code>$link['type']</code>
<code>$link['uri']</code>
Expand Down Expand Up @@ -2770,19 +2743,16 @@
<code>format</code>
<code>format</code>
</InvalidMethodCall>
<MixedArgument occurrences="15">
<MixedArgument occurrences="12">
<code>$cat['label']</code>
<code>$cat['scheme']</code>
<code>$cat['term']</code>
<code>$cat['term']</code>
<code>$content</code>
<code>$data</code>
<code>$data['email']</code>
<code>$data['length']</code>
<code>$data['name']</code>
<code>$data['type']</code>
<code>$data['uri']</code>
<code>$data['uri']</code>
<code>$source</code>
<code>$this-&gt;getDataContainer()-&gt;getDateCreated()-&gt;format(DateTime::ATOM)</code>
<code>$this-&gt;getDataContainer()-&gt;getDateModified()-&gt;format(DateTime::ATOM)</code>
Expand Down Expand Up @@ -2817,13 +2787,12 @@
<ParadoxicalCondition occurrences="1">
<code>! $authors || empty($authors)</code>
</ParadoxicalCondition>
<PossiblyNullArgument occurrences="9">
<PossiblyNullArgument occurrences="8">
<code>$this-&gt;container-&gt;getEncoding()</code>
<code>$this-&gt;getDataContainer()-&gt;getDescription()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getTitle()</code>
Expand All @@ -2847,11 +2816,8 @@
<InvalidArgument occurrences="1">
<code>$container</code>
</InvalidArgument>
<MixedArgument occurrences="7">
<MixedArgument occurrences="4">
<code>$data</code>
<code>$data['email']</code>
<code>$data['name']</code>
<code>$data['uri']</code>
<code>$this-&gt;container-&gt;getReference()</code>
<code>$this-&gt;container-&gt;getWhen()-&gt;format(DateTime::ATOM)</code>
<code>$this-&gt;getDataContainer()-&gt;getComment()</code>
Expand Down Expand Up @@ -2883,11 +2849,8 @@
<InvalidArgument occurrences="1">
<code>$container</code>
</InvalidArgument>
<MixedArgument occurrences="7">
<MixedArgument occurrences="4">
<code>$data</code>
<code>$data['email']</code>
<code>$data['name']</code>
<code>$data['uri']</code>
<code>$this-&gt;container-&gt;getReference()</code>
<code>$this-&gt;container-&gt;getWhen()-&gt;format(DateTime::ATOM)</code>
<code>$this-&gt;getDataContainer()-&gt;getComment()</code>
Expand Down Expand Up @@ -2925,14 +2888,12 @@
<InvalidMethodCall occurrences="1">
<code>format</code>
</InvalidMethodCall>
<MixedArgument occurrences="8">
<MixedArgument occurrences="6">
<code>$cat['scheme']</code>
<code>$cat['term']</code>
<code>$data</code>
<code>$data['type']</code>
<code>$data['uri']</code>
<code>$link</code>
<code>$name</code>
<code>$this-&gt;getDataContainer()-&gt;getDateModified()-&gt;format(DateTime::RSS)</code>
</MixedArgument>
<MixedArrayAccess occurrences="8">
Expand Down Expand Up @@ -2966,14 +2927,11 @@
<ParadoxicalCondition occurrences="1">
<code>! $authors || empty($authors)</code>
</ParadoxicalCondition>
<PossiblyNullArgument occurrences="7">
<PossiblyNullArgument occurrences="4">
<code>$this-&gt;container-&gt;getEncoding()</code>
<code>$this-&gt;getDataContainer()-&gt;getDescription()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getTitle()</code>
</PossiblyNullArgument>
<PossiblyNullReference occurrences="1">
<code>format</code>
Expand All @@ -3000,19 +2958,14 @@
<InvalidMethodCall occurrences="1">
<code>format</code>
</InvalidMethodCall>
<MixedArgument occurrences="14">
<MixedArgument occurrences="9">
<code>$cat['label']</code>
<code>$cat['scheme']</code>
<code>$cat['term']</code>
<code>$cat['term']</code>
<code>$data</code>
<code>$data['email']</code>
<code>$data['name']</code>
<code>$data['uri']</code>
<code>$gdata['name']</code>
<code>$href</code>
<code>$hubUrl</code>
<code>$image['uri']</code>
<code>$this-&gt;getDataContainer()-&gt;getDateModified()-&gt;format(DateTime::ATOM)</code>
<code>$type</code>
</MixedArgument>
Expand All @@ -3033,15 +2986,12 @@
<ParadoxicalCondition occurrences="1">
<code>! $authors || empty($authors)</code>
</ParadoxicalCondition>
<PossiblyNullArgument occurrences="8">
<PossiblyNullArgument occurrences="5">
<code>$gdata['uri']</code>
<code>$gdata['version']</code>
<code>$this-&gt;getDataContainer()-&gt;getDescription()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getLanguage()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getTitle()</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="1">
<code>$gdata['name']</code>
Expand Down Expand Up @@ -3100,19 +3050,14 @@
<InvalidMethodCall occurrences="1">
<code>format</code>
</InvalidMethodCall>
<MixedArgument occurrences="14">
<MixedArgument occurrences="9">
<code>$cat['label']</code>
<code>$cat['scheme']</code>
<code>$cat['term']</code>
<code>$cat['term']</code>
<code>$data</code>
<code>$data['email']</code>
<code>$data['name']</code>
<code>$data['uri']</code>
<code>$gdata['name']</code>
<code>$href</code>
<code>$hubUrl</code>
<code>$image['uri']</code>
<code>$this-&gt;getDataContainer()-&gt;getDateModified()-&gt;format(DateTime::ATOM)</code>
<code>$type</code>
</MixedArgument>
Expand All @@ -3133,15 +3078,12 @@
<ParadoxicalCondition occurrences="1">
<code>! $authors || empty($authors)</code>
</ParadoxicalCondition>
<PossiblyNullArgument occurrences="8">
<PossiblyNullArgument occurrences="5">
<code>$gdata['uri']</code>
<code>$gdata['version']</code>
<code>$this-&gt;getDataContainer()-&gt;getDescription()</code>
<code>$this-&gt;getDataContainer()-&gt;getId()</code>
<code>$this-&gt;getDataContainer()-&gt;getLanguage()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getLink()</code>
<code>$this-&gt;getDataContainer()-&gt;getTitle()</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="1">
<code>$gdata['name']</code>
Expand All @@ -3166,9 +3108,6 @@
<InvalidArrayOffset occurrences="1">
<code>$gdata['name']</code>
</InvalidArrayOffset>
<MixedArgument occurrences="1">
<code>$gdata['name']</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$ext</code>
</MixedAssignment>
Expand Down Expand Up @@ -3202,9 +3141,6 @@
<InvalidArrayOffset occurrences="1">
<code>$gdata['name']</code>
</InvalidArrayOffset>
<MixedArgument occurrences="1">
<code>$gdata['name']</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$ext</code>
</MixedAssignment>
Expand Down Expand Up @@ -3245,15 +3181,9 @@
<code>format</code>
<code>format</code>
</InvalidMethodCall>
<MixedArgument occurrences="10">
<MixedArgument occurrences="4">
<code>$cat['scheme']</code>
<code>$cat['term']</code>
<code>$data</code>
<code>$image['height']</code>
<code>$image['uri']</code>
<code>$image['width']</code>
<code>$name</code>
<code>$name</code>
<code>$this-&gt;getDataContainer()-&gt;getDateModified()-&gt;format(DateTime::RSS)</code>
<code>$this-&gt;getDataContainer()-&gt;getLastBuildDate()-&gt;format(DateTime::RSS)</code>
</MixedArgument>
Expand Down Expand Up @@ -3286,10 +3216,8 @@
<ParadoxicalCondition occurrences="1">
<code>! $authors || empty($authors)</code>
</ParadoxicalCondition>
<PossiblyNullArgument occurrences="3">
<PossiblyNullArgument occurrences="1">
<code>$this-&gt;container-&gt;getEncoding()</code>
<code>$this-&gt;getDataContainer()-&gt;getDescription()</code>
<code>$this-&gt;getDataContainer()-&gt;getTitle()</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="1">
<code>$gdata['name']</code>
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Extension/DublinCore/Renderer/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
foreach ($authors as $data) {
$author = $this->dom->createElement('dc:creator');
if (array_key_exists('name', $data)) {
$text = $dom->createTextNode($data['name']);
$text = $dom->createTextNode((string) $data['name']);
$author->appendChild($text);
$root->appendChild($author);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Extension/DublinCore/Renderer/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
foreach ($authors as $data) {
$author = $this->dom->createElement('dc:creator');
if (array_key_exists('name', $data)) {
$text = $dom->createTextNode($data['name']);
$text = $dom->createTextNode((string) $data['name']);
$author->appendChild($text);
$root->appendChild($author);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root)
return;
}
$el = $dom->createElement('googleplay:block');
$text = $dom->createTextNode($block);
$text = $dom->createTextNode((string) $block);
$el->appendChild($text);
$root->appendChild($el);
$this->called = true;
Expand All @@ -79,7 +79,7 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root)
return;
}
$el = $dom->createElement('googleplay:explicit');
$text = $dom->createTextNode($explicit);
$text = $dom->createTextNode((string) $explicit);
$el->appendChild($text);
$root->appendChild($el);
$this->called = true;
Expand All @@ -97,7 +97,7 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root)
return;
}
$el = $dom->createElement('googleplay:description');
$text = $dom->createTextNode($description);
$text = $dom->createTextNode((string) $description);
$el->appendChild($text);
$root->appendChild($el);
$this->called = true;
Expand Down

0 comments on commit a57fdb9

Please sign in to comment.