Skip to content

Commit

Permalink
Use Null Coalesce Operator instead of array_key_exists + if
Browse files Browse the repository at this point in the history
  • Loading branch information
carusogabriel authored and kukulich committed Apr 20, 2019
1 parent 649fdaa commit 971b856
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions SlevomatCodingStandard/Helpers/AnnotationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ public static function getAnnotationsByName(File $phpcsFile, int $pointer, strin
{
$annotations = self::getAnnotations($phpcsFile, $pointer);

if (!array_key_exists($annotationName, $annotations)) {
return [];
}

return $annotations[$annotationName];
return $annotations[$annotationName] ?? [];
}

/**
Expand Down

0 comments on commit 971b856

Please sign in to comment.