for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BeyondCode\Mailbox;
use BeyondCode\Mailbox\Drivers\DriverInterface;
use Closure;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Manager;
class MailboxManager extends Manager
{
/**
* Create a new manager instance.
*
* @param Container $container
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
*/
public function __construct(Container $container)
parent::__construct($container);
$this->registerDrivers();
}
public function getDefaultDriver()
return $this->container['config']['mailbox.driver'];
protected function registerDrivers(): void
$supported = config('mailbox.supported_drivers');
foreach ($supported as $driver => $mappedTo) {
$callback = is_callable($mappedTo) ?
$mappedTo : $this->registerDriverCallable($mappedTo);
$this->extend($driver, $callback);
$callback
callable
object<Closure>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
protected function registerDriverCallable(string $driver): Closure
return function () use ($driver): DriverInterface {
return new $driver;
};
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.