Skip to content
Discussion options

You must be logged in to vote

@brandonkelly you can use PHPStan\Type\Constant\ConstantBooleanType(false) for that:

return static function(ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(AddReturnTypeDeclarationRector::class)
        ->configure([
            new AddReturnTypeDeclaration('my\\class', 'myMethod', new UnionType([
                new \PHPStan\Type\IntegerType(),
                new \PHPStan\Type\Constant\ConstantBooleanType(false)(),
            ]))
        ]);
};

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@brandonkelly
Comment options

Comment options

You must be logged in to vote
1 reply
@brandonkelly
Comment options

Answer selected by samsonasik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants