Issues (30)

src/Bridges/LaravelContainer.php (3 issues)

1
<?php
2
3
namespace Nip\Container\Bridges;
4
5
use League\Container\Container as Container;
6
7
/**
8
 * Class LeagueContainer
9
 * @package Nip\Container\Bridges
10
 */
11
abstract class LaravelContainer extends Container implements BridgeInterface
12
{
13
    public function share($alias, $concrete = null)
14
    {
15
        $this->singleton($alias, $concrete);
0 ignored issues
show
The method singleton() does not exist on Nip\Container\Bridges\LaravelContainer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        $this->/** @scrutinizer ignore-call */ 
16
               singleton($alias, $concrete);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug Best Practice introduced by
The expression ImplicitReturnNode returns the type null which is incompatible with the return type mandated by League\Container\Container::share() of League\Container\Definition\DefinitionInterface.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
16
    }
17
18
    public function add($alias, $concrete = null, $share = false)
19
    {
20
        return $this->bind($alias, $concrete, $share);
0 ignored issues
show
The method bind() does not exist on Nip\Container\Bridges\LaravelContainer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        return $this->/** @scrutinizer ignore-call */ bind($alias, $concrete, $share);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
    }
22
}
23