Skip to content

DI\link() shorten to link() conflicts with PHP's native link() function -> replace with DI\get() #235

@mnapoli

Description

@mnapoli

With PHP 5.6 we can import functions:

use function DI\object;

return [
    'FooInterface' => object('Foo'),
];

However DI\link() would be shortened to link(), which already exist in the root namespace as the link() function

This is not a show stopper since we can still use DI\link() or use function DI\link and later link(), but this is confusing for users. Also PhpStorm will by default not offer to import the function as it recognizes PHP's built-in link() function…

I've never liked link() anyway so this could be a good reason to introduce an alternative in PHP-DI 5, such as get(). Of course DI\link() would continue to work and would be an alias to DI\get().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions