Skip to content

Commit

Permalink
Fix new Psalm errors
Browse files Browse the repository at this point in the history
  • Loading branch information
scheb committed Oct 14, 2020
1 parent 0d7fa13 commit 0564ee9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/analyzer/Report/Console/ConsoleReportGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ private function printTombstone(Tombstone $tombstone, string $prefix): void
{
$this->output->writeln(sprintf(' [%s] <info>%s</info>', $prefix, (string) $tombstone));
$this->output->writeln(sprintf(' in <comment>line %s</comment>', $tombstone->getLine()));
if ($tombstone->getMethod()) {
$this->output->writeln(sprintf(' in method <comment>%s</comment>', $tombstone->getMethod()));
$method = $tombstone->getMethod();
if ($method) {
$this->output->writeln(sprintf(' in method <comment>%s</comment>', $method));
} else {
$this->output->writeln(sprintf(' in global scope'));
}
Expand Down
5 changes: 3 additions & 2 deletions src/analyzer/Report/Html/Renderer/DashboardRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ private function getLastCalled(Vampire $vampire): string

private function getTombstoneScope(Tombstone $tombstone): string
{
if ($tombstone->getMethod()) {
return sprintf('method <samp>%s</samp>', htmlspecialchars($tombstone->getMethod()));
$method = $tombstone->getMethod();
if ($method) {
return sprintf('method <samp>%s</samp>', htmlspecialchars($method));
}

return 'global scope';
Expand Down
1 change: 1 addition & 0 deletions src/analyzer/Stock/TombstoneNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private function visitFunctionNode(Function_ $node): void
*/
private function getNamespacedName($node): string
{
/** @psalm-suppress DocblockTypeContradiction */
if (!isset($node->namespacedName)) {
$nodeName = isset($node->name) ? (string) $node->name : '<anonymous>';
throw new \RuntimeException(sprintf('Node %s of type %s did not provide attribute namespacedName', $nodeName, \get_class($node)));
Expand Down

0 comments on commit 0564ee9

Please sign in to comment.