Skip to content

@throws void is ignored in a stub file #7552

@VincentLanglet

Description

@VincentLanglet

Bug report

I have the following stub file

<?php

/**
 * We can consider that this method will never throw an exception
 *
 * @throws void
 */
function random_int(int $min, int $max): int {}

And I added my php.stub file to the stubFiles section of my phpstan.neon.
I also use missingCheckedExceptionInThrows.

Expected output

When I use random_int I would expect no error from phpstan but I get

... throws checked exception Exception but it's missing from the PHPDoc @throws tag

Am I doing something wrong or would it be possible that the throws void is not correctly handled in a stub file for native functions.

Did PHPStan help you today? Did it make you happy in any way?

Sure, trying to integrate the exceptions checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions