Skip to content

Commit

Permalink
fix(mentions): return early if xml null
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideIadeluca committed Oct 7, 2024
1 parent 2d598e5 commit 20c292c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extensions/mentions/src/Formatter/UnparsePostMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public function __construct(TranslatorInterface $translator)
*/
public function __invoke($context, $xml)
{
if ($xml === null) {

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Strict comparison using === between string and null will always evaluate to false.
return $xml;
}

$xml = $this->updatePostMentionTags($context, $xml);
$xml = $this->unparsePostMentionTags($xml);

Expand Down
4 changes: 4 additions & 0 deletions extensions/mentions/src/Formatter/UnparseTagMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class UnparseTagMentions
*/
public function __invoke($context, $xml)
{
if ($xml === null) {

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Strict comparison using === between string and null will always evaluate to false.
return $xml;
}

$xml = $this->updateTagMentionTags($context, $xml);
$xml = $this->unparseTagMentionTags($xml);

Expand Down
4 changes: 4 additions & 0 deletions extensions/mentions/src/Formatter/UnparseUserMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function __construct(TranslatorInterface $translator)
*/
public function __invoke($context, $xml)
{
if ($xml === null) {

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Strict comparison using === between string and null will always evaluate to false.
return $xml;
}

$xml = $this->updateUserMentionTags($context, $xml);
$xml = $this->unparseUserMentionTags($xml);

Expand Down

0 comments on commit 20c292c

Please sign in to comment.