for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by: Jens
* Date: 12-10-2017
*/
namespace CloudControl\Cms\services;
use CloudControl\Cms\storage\entities\Valuelist;
use CloudControl\Cms\storage\Storage;
class ValuelistService
{
private static $instance;
* @var Storage
protected $storage;
* FileService constructor.
protected function __construct()
{}
* @return ValuelistService
public static function getInstance()
if (!self::$instance instanceof ValuelistService) {
self::$instance = new ValuelistService();
}
return self::$instance;
* @param $slug
* @return Valuelist
public static function get($slug)
$instance = self::getInstance();
$valuelist = $instance->storage->getValuelists()->getValuelistBySlug($slug);
return new Valuelist($valuelist);
$valuelist
object<CloudControl\Cms\...ntities\Valuelist>|null
object<stdClass>
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);
* @param Storage $storage
public function init(Storage $storage)
$this->storage = $storage;
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: