Skip to content

Proposal: Enable global_namespace_import #36

Open

Description

@provokateurin

With configuration ['import_classes' => false, 'import_constants' => false, 'import_functions' => false]: https://cs.symfony.com/doc/rules/import/global_namespace_import.html#example-3

Main benefit for me would be exceptions, as it is a directly clear that a docblock like

/**
 * @throws Exception
 */

refers to \OCP\DB\Exception and not \Exception.
It would also safe some lines in the imports making them a bit more readable.

We could also switch it around, but I think we should settle on some configuration for this rule to have it the same everywhere.

Activity

  1. added
    enhancement
    on Sep 21, 2024
  2. nickvergessen commented on Sep 21, 2024

    @nickvergessen
    Member

    I agree that for global classes it's better readable/understandable if they are fully qualified inline

  3. blizzz commented on Oct 1, 2024

    @blizzz
    Member

    I am fine either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions