Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses in types are not supported #305

Open
danog opened this issue Dec 27, 2022 · 0 comments
Open

Parentheses in types are not supported #305

danog opened this issue Dec 27, 2022 · 0 comments

Comments

@danog
Copy link
Contributor

danog commented Dec 27, 2022

In the following example, a mapper error is only thrown when validating b, not when validating a.
Note that parentheses are supported by both psalm and phpstan, and are actually often generated when using phpcs in fix mode, which makes use of phpstan's docblock parser and printer.

<?php

use CuyZ\Valinor\MapperBuilder;

require 'vendor/autoload.php';

final class a {

    /**
     * @param (0|1) $a
     */
    public function __construct(
        public readonly int $a,
    ) {
    }
}

final class b {

    /**
     * @param 0|1 $a
     */
    public function __construct(
        public readonly int $a,
    ) {
    }
}


(new MapperBuilder)->mapper()->map(a::class, 2);
(new MapperBuilder)->mapper()->map(b::class, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant