Skip to content

Commit

Permalink
Merge pull request #34 from jaapio/feature/code-style-improvements
Browse files Browse the repository at this point in the history
Improves code style
  • Loading branch information
mvriel committed Jun 3, 2017
2 parents 18db4ab + ca661c2 commit fb39335
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 132 deletions.
1 change: 1 addition & 0 deletions src/FqsenResolver.php
Expand Up @@ -52,6 +52,7 @@ private function isFqsen($type)
* @param Context $context
*
* @return Fqsen
* @throws \InvalidArgumentException when type is not a valid FQSEN.
*/
private function resolvePartialStructuralElementName($type, Context $context)
{
Expand Down
45 changes: 23 additions & 22 deletions src/TypeResolver.php
Expand Up @@ -29,28 +29,28 @@ final class TypeResolver

/** @var string[] List of recognized keywords and unto which Value Object they map */
private $keywords = array(
'string' => 'phpDocumentor\Reflection\Types\String_',
'int' => 'phpDocumentor\Reflection\Types\Integer',
'integer' => 'phpDocumentor\Reflection\Types\Integer',
'bool' => 'phpDocumentor\Reflection\Types\Boolean',
'boolean' => 'phpDocumentor\Reflection\Types\Boolean',
'float' => 'phpDocumentor\Reflection\Types\Float_',
'double' => 'phpDocumentor\Reflection\Types\Float_',
'object' => 'phpDocumentor\Reflection\Types\Object_',
'mixed' => 'phpDocumentor\Reflection\Types\Mixed',
'array' => 'phpDocumentor\Reflection\Types\Array_',
'resource' => 'phpDocumentor\Reflection\Types\Resource',
'void' => 'phpDocumentor\Reflection\Types\Void_',
'null' => 'phpDocumentor\Reflection\Types\Null_',
'scalar' => 'phpDocumentor\Reflection\Types\Scalar',
'callback' => 'phpDocumentor\Reflection\Types\Callable_',
'callable' => 'phpDocumentor\Reflection\Types\Callable_',
'false' => 'phpDocumentor\Reflection\Types\Boolean',
'true' => 'phpDocumentor\Reflection\Types\Boolean',
'self' => 'phpDocumentor\Reflection\Types\Self_',
'$this' => 'phpDocumentor\Reflection\Types\This',
'static' => 'phpDocumentor\Reflection\Types\Static_',
'parent' => 'phpDocumentor\Reflection\Types\Parent_',
'string' => Types\String_::class,
'int' => Types\Integer::class,
'integer' => Types\Integer::class,
'bool' => Types\Boolean::class,
'boolean' => Types\Boolean::class,
'float' => Types\Float_::class,
'double' => Types\Float_::class,
'object' => Object_::class,
'mixed' => Types\Mixed::class,
'array' => Array_::class,
'resource' => Types\Resource::class,
'void' => Types\Void_::class,
'null' => Types\Null_::class,
'scalar' => Types\Scalar::class,
'callback' => Types\Callable_::class,
'callable' => Types\Callable_::class,
'false' => Types\Boolean::class,
'true' => Types\Boolean::class,
'self' => Types\Self_::class,
'$this' => Types\This::class,
'static' => Types\Static_::class,
'parent' => Types\Parent_::class,
'iterable' => Iterable_::class,
);

Expand Down Expand Up @@ -255,6 +255,7 @@ private function resolveKeyword($type)
* Resolves the given FQSEN string into an FQSEN object.
*
* @param string $type
* @param Context|null $context
*
* @return Object_
*/
Expand Down
1 change: 0 additions & 1 deletion src/Types/Array_.php
Expand Up @@ -12,7 +12,6 @@

namespace phpDocumentor\Reflection\Types;

use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\Type;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Types/Compound.php
Expand Up @@ -24,12 +24,13 @@
final class Compound implements Type
{
/** @var Type[] */
private $types = [];
private $types;

/**
* Initializes a compound type (i.e. `string|int`) and tests if the provided types all implement the Type interface.
*
* @param Type[] $types
* @throws \InvalidArgumentException when types are not all instance of Type
*/
public function __construct(array $types)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Types/Context.php
Expand Up @@ -29,10 +29,10 @@
final class Context
{
/** @var string The current namespace. */
private $namespace = '';
private $namespace;

/** @var array List of namespace aliases => Fully Qualified Namespace. */
private $namespaceAliases = [];
private $namespaceAliases;

/**
* Initializes the new context and normalizes all passed namespaces to be in Qualified Namespace Name (QNN)
Expand Down
2 changes: 1 addition & 1 deletion src/Types/ContextFactory.php
Expand Up @@ -32,7 +32,7 @@ final class ContextFactory
/**
* Build a Context given a Class Reflection.
*
* @param \ReflectionClass $reflector
* @param \Reflector $reflector
*
* @see Context for more information on Contexts.
*
Expand Down
1 change: 1 addition & 0 deletions src/Types/Object_.php
Expand Up @@ -31,6 +31,7 @@ final class Object_ implements Type
* Initializes this object with an optional FQSEN, if not provided this object is considered 'untyped'.
*
* @param Fqsen $fqsen
* @throws \InvalidArgumentException when provided $fqsen is not a valid type.
*/
public function __construct(Fqsen $fqsen = null)
{
Expand Down

0 comments on commit fb39335

Please sign in to comment.