for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: Clayton Daley
* Date: 5/6/2015
* Time: 6:43 PM
*/
namespace ZfcUser\Factory\Mapper;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfcUser\Mapper;
class User implements FactoryInterface
{
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
public function createService(ServiceLocatorInterface $serviceLocator)
$options = $serviceLocator->get('zfcuser_module_options');
$mapper = new Mapper\User();
$mapper->setDbAdapter($serviceLocator->get('zfcuser_zend_db_adapter'));
$serviceLocator->get('zfcuser_zend_db_adapter')
object|array
object<Zend\Db\Adapter\Adapter>
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);
$entityClass = $options->getUserEntityClass();
$mapper->setEntityPrototype(new $entityClass);
$mapper->setHydrator(new Mapper\UserHydrator());
$mapper->setTableName($options->getTableName());
return $mapper;
}
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: