Skip to content

TooManyTemplateParams errors with recent psalm #137

Closed
@lazka

Description

@lazka
<?php
use MyCLabs\Enum\Enum;

/**
 * @method static Level __default()
 * @method static Level intOnly()
 * @method static Level full()
 *
 * @psalm-immutable
 */
class Level extends Enum
{
    private const __default = 'intOnly';
    private const intOnly = 'intOnly';
    private const full = 'full';
}

This now leads to

ERROR: TooManyTemplateParams - ../../myclabs/php-enum/src/Enum.php:54:21 - MyNameSpace\Level<T:MyCLabs\Enum\Enum as mixed> has too many template params, expecting 0 (see https://psalm.dev/184)
     * @psalm-param static<T>|T $value

Any ideas on how to work around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions