Skip to content

Regression implementing contract with nullable type #875

@dantleech

Description

@dantleech

Given:

interface IndexQuery
{
    public function implementing(FullyQualifiedName $name): References;

    public function class(FullyQualifiedName $name): ?ClassRecord;
}

we get

<?php

namespace Phpactor\ProjectQuery\Adapter\Dbal;

use ?Phpactor\ProjectQuery\Model\Record\ClassRecord;
use Phpactor\Name\FullyQualifiedName;
use Phpactor\ProjectQuery\Model\IndexQuery;
use Phpactor\ProjectQuery\Model\References;

class DbalIndexQuery implements IndexQuery
{
    public function implementing(FullyQualifiedName $name): References
    {
    }
    public function class(FullyQualifiedName $name): ClassRecord
    {
    }
}

Note the use statement has a ? (when the ClassRecord of class should have the nullable type.

@elythyr I guess this is rather to do with the code-builder library than the WorseReflection change and might be fixed with the forthcoming Nullable types PR there.

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