dox Executable Documentation

Read interface properties

Find public properties

Given the class 'publicProperties\\SomeClass' with the body ' public $public = "one"; private $private = "four"; public static $static = "not"; '
When I determine the properties of 'publicProperties\\SomeClass'
Then there should be 1 properties
Then 'public' should be gettable
Then 'public' should be settable
Then the value of 'public' should be 'one'

Find accessor properties

Given the class 'accessors\\SomeClass' with the body ' function getGetter() { return "seven"; } function isBoolean() { return true; } function setSetter($a) { } function getBoth() {} function setBoth($a) {} function notAnAccessor() {} function getNeither ($becauseOfTheParameter) {} static function getStatic() {} '
When I determine the properties of 'accessors\\SomeClass'
Then there should be 4 properties
Then 'getter' should be gettable
Then 'getter' should not be settable
Then 'setter' should be settable
Then 'setter' should not be gettable
Then 'boolean' should be gettable
Then the value of 'getter' should be 'seven'
Then the value of 'boolean' should be true

Public trump accessor

Given the class 'both\\SomeClass' with the body ' public $publicAndGetter = "public"; function getPublicAndGetter() { return "getter"; } '
When I determine the properties of 'both\\SomeClass'
Then there should be 1 properties
Then the value of 'publicAndGetter' should be 'public'

Find constructor properties

Given the class 'constructor\\ClassWithConstructor' with the body ' function __construct($one = null) {} '
When I determine the properties of 'constructor\\ClassWithConstructor'
Then there should be 1 properties
Then 'one' should be settable
Then 'one' should not be gettable

Merge properties

Given the class 'mergeProperties\\SomeClass' with the body ' public $one; function __construct($one = null, $two = null) {} function getTwo() {} '
When I determine the properties of 'mergeProperties\\SomeClass'
Then there should be 2 properties
Then 'one' should be gettable
Then 'two' should be gettable

Required properties

Given the class 'required\\SomeClass' with the body ' public $two; public $four; function __construct($one, $two, $three = null) {} '
Given the constructor argument 'one' is 'uno'
Given the constructor argument 'two' is 'dos'
When I determine the properties of 'required\\SomeClass'
Then there should be 4 properties
Then 'one' should be required
Then 'two' should be required
Then 'three' should be optional
Then 'four' should be optional

Public property types

Given the class 'publicTypes\\SomeClass' with the body ' /** @var int */ public $int; /** @var string */ public $string; /** @var \\DateTime */ public $class; public $unknown; '
When I determine the properties of 'publicTypes\\SomeClass'
Then there should be 4 properties
Then 'int' should have the type IntegerType::$CLASS
Then 'string' should have the type StringType::$CLASS
Then 'class' should have the type ClassType::$CLASS
Then the class of 'class' should be 'DateTime'
Then 'unknown' should have the type UnknownType::$CLASS

Accessor types

Given the class 'accessorTypes\\SomeClass' with the body ' /** @return long */ function getOne() {} /** @param float $two */ function setTwo($two) {} function setThree(\\DateTime $three) {} '
When I determine the properties of 'accessorTypes\\SomeClass'
Then there should be 3 properties
Then 'one' should have the type LongType::$CLASS
Then 'two' should have the type FloatType::$CLASS
Then 'three' should have the type ClassType::$CLASS

Constructor types

Given the class 'constructorTypes\\SomeClass' with the body ' /** @param integer $one */ function __construct($one, \\DateTime $two) {} '
Given the constructor argument 'one' is 'uno'
Given the constructor argument 'two' is new \DateTime()
When I determine the properties of 'constructorTypes\\SomeClass'
Then there should be 2 properties
Then 'one' should have the type IntegerType::$CLASS
Then 'two' should have the type ClassType::$CLASS

Optional constructor types

Given the class 'optionalConstructorTypes\\SomeClass' with the body ' function __construct(\\DateTime $one = null) {} '
When I determine the properties of 'optionalConstructorTypes\\SomeClass'
Then there should be 1 properties
Then 'one' should have the type NullableType::$CLASS

Complex types

Given the class 'ComplexTypes\\SomeClass' with the body ' /** @var null|int */ public $int; /** @var string[] */ public $array; /** @var array|array[]|\\DateTime[][] */ public $deepArray; /** @var int|string */ public $multi; /** @var int|int */ public $notMulti; /** @var int[]|string[] */ public $multiArray; /** @var string */ public $merged; /** @return double */ function getMerged() {} '
When I determine the properties of 'ComplexTypes\\SomeClass'
Then there should be 7 properties
Then 'int' should have the type NullableType::$CLASS
Then the inner type of 'int' should be IntegerType::$CLASS
Then 'array' should have the type ArrayType::$CLASS
Then the item type of 'array' should be StringType::$CLASS
Then 'deepArray' should have the type ArrayType::$CLASS
Then the item type of 'deepArray' should be ArrayType::$CLASS
Then the item type of the item type of 'deepArray' should be ClassType::$CLASS
Then 'multi' should have the type MultiType::$CLASS
Then the types of 'multi' should be array(IntegerType::$CLASS, StringType::$CLASS)
Then 'notMulti' should have the type IntegerType::$CLASS
Then 'multiArray' should have the type ArrayType::$CLASS
Then the item type of 'multiArray' should be MultiType::$CLASS
Then 'merged' should have the type MultiType::$CLASS
Then the types of 'merged' should be array(StringType::$CLASS, DoubleType::$CLASS)

De duplicate types

Given the class 'deDuplicate\\SomeClass' with the body ' /** @var \\deDuplicate\\some\\OtherClass|null */ public $one; function __construct(some\\OtherClass $one = null) {} function getOne() {} function getUnknown() {} function setUnknown($u) {} /** @return string */ function getNullable() {} /** @param string $s */ function setNullable($s = null) {} '
Given the class 'deDuplicate\\some\\OtherClass'
Given the class 'deDuplicate\\some\\OtherClassId' with the body 'function __toString() { return "foo"; }'
When I determine the properties of 'deDuplicate\\SomeClass'
Then there should be 3 properties
Then 'one' should have the type NullableType::$CLASS
Then the inner type of 'one' should be ClassType::$CLASS
Then 'unknown' should have the type UnknownType::$CLASS
Then 'nullable' should have the type MultiType::$CLASS

Doc comment

Given the class 'docComments\\SomeClass' with the body ' /** * @var string Some comment */ public $public; /** * @param string $one Comment One * @param string $two Comment Two */ function __construct($one, $two) {} /** * @return string A comment as well */ function getGetter() {} /** * @param $g Ignored */ function setGetter($g) {} /** * @param $a And this too */ function setSetter($a) {} '
Given the constructor argument 'one' is '1'
Given the constructor argument 'two' is '2'
When I determine the properties of 'docComments\\SomeClass'
Then there should be 5 properties
Then 'public' should have the comment 'Some comment'
Then 'one' should have the comment 'Comment One'
Then 'two' should have the comment 'Comment Two'
Then 'getter' should have the comment 'A comment as well'
Then 'setter' should have the comment 'And this too'