Skip to content

Commit

Permalink
PHPStan- Fixed the undefined property error in ReplaceVideoRefId job
Browse files Browse the repository at this point in the history
  • Loading branch information
ssethupathy committed Aug 2, 2023
1 parent 9bf13af commit 9a71863
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 4 additions & 2 deletions sourcecode/apis/contentauthor/app/Jobs/ReplaceVideoRefId.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ private function traverseParameters(Collection $parameters)
{
/** @var Collection $parameters */
$processedParams = $parameters->map(function ($value) {
if (!empty($value->mime) && $this->videoAdapter->isTargetType($value->mime, $value->path)) {
$value = $this->replaceRef($value);
if (is_object($value) && property_exists($value, 'mime') && property_exists($value, 'path')) {
if (!empty($value->mime) && $this->videoAdapter->isTargetType($value->mime, $value->path)) {
$value = $this->replaceRef($value);

Check warning on line 76 in sourcecode/apis/contentauthor/app/Jobs/ReplaceVideoRefId.php

View check run for this annotation

Codecov / codecov/patch

sourcecode/apis/contentauthor/app/Jobs/ReplaceVideoRefId.php#L74-L76

Added lines #L74 - L76 were not covered by tests
}
}

if ((bool)(array)$value && (is_array($value) || is_object($value))) {
Expand Down
5 changes: 0 additions & 5 deletions sourcecode/apis/contentauthor/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ parameters:
count: 6
path: app/Http/Controllers/API/QuestionsetController.php

-
message: "#^Access to an undefined property object\\:\\:\\$path\\.$#"
count: 1
path: app/Jobs/ReplaceVideoRefId.php

-
message: "#^Access to an undefined property object\\:\\:\\$tags\\.$#"
count: 1
Expand Down

0 comments on commit 9a71863

Please sign in to comment.