for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ChinLeung\MultilingualRoutes\Macros;
use ChinLeung\MultilingualRoutes\MultilingualRegistrar;
use ChinLeung\MultilingualRoutes\MultilingualRoutePendingRegistration;
use Closure;
class RouterMacros
{
/**
* Register a multilingual GET route.
*
* @param string $key
* @param mixed $handle
* @param array $locales
* @return \Closure
*/
public function multilingual(): Closure
return function ($key, $handle = null, $locales = []) {
return new MultilingualRoutePendingRegistration(
$this->container && $this->container->bound(MultilingualRegistrar::class)
? $this->container->make(MultilingualRegistrar::class)
: new MultilingualRegistrar($this),
$this
this<ChinLeung\Multiling...es\Macros\RouterMacros>
object<Illuminate\Routing\Router>
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);
ltrim($key, '/'),
$handle,
$locales ?: locales()
);
};
}
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: