for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: root
* Date: 27.07.2016
* Time: 1:55.
*/
namespace samsonframework\container\annotation;
use samsonframework\container\metadata\ClassMetadata;
* Service annotation class.
*
* This annotation adds class to Service container scope.
* @see samsonframework\container\Container::SCOPE_SERVICE
* @Annotation
class Service extends CollectionValue implements ClassInterface
{
/** @var string Service unique name */
protected $name;
* Service constructor.
* @param string $name Service unique name
* @throws \InvalidArgumentException
public function __construct($name)
parent::__construct($name);
$name
string
array
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);
// Get first argument
$this->name = array_shift($this->collection);
}
/** {@inheritdoc} */
public function toClassMetadata(ClassMetadata $metadata)
$metadata->name = $this->name;
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: