Skip to content

Commit

Permalink
Merge branch 'fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyShepherd committed Mar 11, 2017
2 parents 67167bc + 251fe67 commit b0bc398
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions src/Factory/Reflection/ReflectionMethodFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ protected function addParamAnnotation($name, $value) : void

if (!$this->parameters->containsKey($param))
{
throw new \Exception();
throw new \Exception
(
'Tried to set param annotation for non existant '
. 'parameter: ' . $param
);
}

$comparator = new TypeComparator();
Expand All @@ -162,7 +166,7 @@ protected function addParamAnnotation($name, $value) : void

if (!$comparator->compatible($nativeType, $type))
{
throw new \Exception();
throw new \Exception('Types are incompatible');
}

$param->setRawValue('type', $type);
Expand All @@ -182,7 +186,7 @@ protected function addParameter
{
$parameter = new ReflectionParameter();
$accessor = new RawPropertyAccessor($parameter);
$type = $this->typeParser->parse((string)$reflect->getType());
$type = (new TypeParser())->parse((string)$reflect->getType());

$this->parameters['$' . $reflect->getName()] = $accessor;
$this->accessor->rawAddToValue('parameters', $parameter);
Expand Down
10 changes: 5 additions & 5 deletions src/Service/PropertyAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ public function constructObject(...$args)
*/
protected function buildProperty(ReflectionProperty $property)
{
if ($property->type instanceof ObjectType)
if (!$property->type instanceof ObjectType)
{
$class = $property->type->classname;
$this->setRawValue($property->name, new $class());
$this->setAnyValue($property, 0);
}
else
elseif ($property->builtInConstructor)
{
$this->setAnyValue($property, 0);
$class = $property->type->classname;
$this->setRawValue($property->name, new $class());
}
}

Expand Down

0 comments on commit b0bc398

Please sign in to comment.