vimeo/psalm

Mixed issues not being reported

Open

#9 619 ouverte le 7 avr. 2023

Voir sur GitHub
 (11 commentaires) (0 réactions) (0 assignés)PHP (668 forks)batch import
Help wantedbugeasy problemsgood first issue

Métriques du dépôt

Stars
 (5 369 stars)
Métriques de merge PR
 (Merge moyen 3j 12h) (5 PRs mergées en 30 j)

Description

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

Guide contributeur