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

Add PHPStan configuration for ConfigProcessor::process #963

Merged
merged 2 commits into from
Dec 9, 2021

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Dec 9, 2021

This way, PHPStan knows that input becomes output.

Example, not PHPStan understands this:

/**
 * @phpstan-import-type ObjectConfig from ObjectType
 */
final class MYType extends ObjectType implements AliasedInterface
{
    public function __construct(ConfigProcessor $processor, GraphQLServiceLocator $locator)
    {
        /**
         * @var ObjectConfig $config
         */
        $config = [
            'name' => self::NAME,
            'fields' => fn () => [
                'id' => [
                    'type' => Type::nonNull(Type::id()),
                ],
            ],
            'interfaces' => fn () => [
                $locator->getType(NodeType::class),
            ],
        ];
    
        parent::__construct($processor->process($config));
    }
}

@ruudk ruudk requested a review from mcg-web December 9, 2021 10:55
@ruudk ruudk changed the base branch from 0.14 to master December 9, 2021 10:58
This way, PHPStan knows that input becomes output.
This way, PHPStan knows the output type.
@mcg-web mcg-web merged commit a74a507 into master Dec 9, 2021
@mcg-web mcg-web deleted the config-processor branch December 9, 2021 13:00
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

Successfully merging this pull request may close these issues.

None yet

2 participants