vimeo/psalm

Mixed issues not being reported

Open

#9,619 opened on 2023年4月7日

GitHub で見る
 (11 comments) (0 reactions) (0 assignees)PHP (668 forks)batch import
Help wantedbugeasy problemsgood first issue

Repository metrics

Stars
 (5,369 stars)
PR merge metrics
 (平均マージ 3d 12h) (30d で 5 merged PRs)

説明

For the following config

<?xml version="1.0"?>
<psalm
    errorLevel="5"
    resolveFromConfigFile="true"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
    findUnusedBaselineEntry="false"
    findUnusedCode="false"
    usePhpDocPropertiesWithoutMagicCall="true"
    reportMixedIssues="true"
>
    <projectFiles>
        <directory name="src" />
        <ignoreFiles>
            <directory name="vendor" />
        </ignoreFiles>
    </projectFiles>
    <issueHandlers>
        <MixedArgument errorLevel="error" />
        <MixedAssignment errorLevel="error" />
        <MixedPropertyAssignment errorLevel="error" />
    </issueHandlers>
</psalm>

running psalm for this code

<?php

/**
 * Safely access the values in $this->params.
 *
 * @param string $name The name or dotted path to parameter.
 * @param mixed $default The default value if `$name` is not set. Default `null`.
 * @return mixed
 */
function getParam(string $name, $default = null)
{
    if ($name && $default) {} // suppress unused name warnings
    return null;
}

$type = getParam('type');
$type = strtolower($type);

echo $type;

I would expect the same errors to be reported as seen on https://psalm.dev/r/34a696dcc4

yet I get No errors found!.

コントリビューターガイド