Skip to content

Don’t reference fully qualfiied namespaces #45

@lstrojny

Description

@lstrojny

One should not reference fully qualified namespaces but always import.

This:

use YadaYada\FooException;
use YadaYada\Foo;

/** @throws FooException */
/** @param Foo */

function (Foo $foo) {}

Not that:

/** @throws \YadaYada\FooException */
/** @param \YadaYada\Foo */

function (\YadaYada\Foo $foo) {}

… and many more cases. Straight from my head:

  • @throws
  • @param
  • @return
  • Type hints in function/method/closure signatures
  • Type hints in return values
  • implements/extends
  • new statement

We should still allow for partial use statements thow:

use Doctrine\ORM\Annotations as ORM;

/** @ORM\Foo() */

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