vimeo/psalm

Mixed issues not being reported

Open

#9619 aperta il 7 apr 2023

Vedi su GitHub
 (11 commenti) (0 reazioni) (0 assegnatari)PHP (668 fork)batch import
Help wantedbugeasy problemsgood first issue

Metriche repository

Star
 (5369 star)
Metriche merge PR
 (Merge medio 3g 12h) (5 PR mergiate in 30 g)

Descrizione

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!.

Guida contributor