Permalink
Browse files

Fix and improve DocBlocks

  • Loading branch information...
1 parent 6309fbc commit 4b53e131e42316fdd85842cf80ffd1fc56a633fb @lanthaler committed Dec 30, 2015
@@ -62,7 +62,7 @@ public function getGraph($name = null);
/**
* Get graph names
*
- * @return array[string] Returns the names of all graphs in the document.
+ * @return string[] Returns the names of all graphs in the document.
*/
public function getGraphNames();
@@ -30,7 +30,7 @@ class InvalidQuadException extends \RuntimeException
*
* @param string $message The error message
* @param Quad $quad The quad
- * @param \Exception $previous The previous exception
+ * @param null|\Exception $previous The previous exception
*/
public function __construct($message, $quad, \Exception $previous = null)
{
@@ -234,11 +234,11 @@ class JsonLdException extends \RuntimeException
/**
* Constructor.
*
- * @param string $code The error code
- * @param string $message The error message
- * @param mixed $snippet The code snippet
- * @param string $document The document that triggered the error
- * @param Exception $previous The previous exception
+ * @param string $code The error code
+ * @param null|string $message The error message
+ * @param null|mixed $snippet The code snippet
+ * @param null|string $document The document that triggered the error
+ * @param null|\Exception $previous The previous exception
*/
public function __construct($code, $message = null, $snippet = null, $document = null, \Exception $previous = null)
{
View
@@ -44,7 +44,7 @@ class Graph implements GraphInterface, JsonLdSerializable
/**
* Constructor
*
- * @param DocumentInterface $document The document the graph belongs to.
+ * @param null|DocumentInterface $document The document the graph belongs to.
*/
public function __construct(DocumentInterface $document = null)
{
View
@@ -51,8 +51,8 @@ public function removeNode(NodeInterface $node);
/**
* Get all nodes
*
- * @return array[Node] Returns an array containing all nodes defined in
- * the document.
+ * @return Node[] Returns an array containing all nodes defined in the
+ * document.
*/
public function getNodes();
@@ -70,8 +70,8 @@ public function getNode($id);
*
* @param string|Node $type The type
*
- * @return array[Node] Returns an array containing all nodes of the
- * specified type in the document.
+ * @return Node[] Returns an array containing all nodes of the specified
+ * type in the document.
*/
public function getNodesByType($type);
View
@@ -196,7 +196,7 @@ public static function expand($input, $options = null)
* The options parameter might be passed as associative array or as
* object.
*
- * @param array $input The JSON-LD document to
+ * @param string|object|array $input The JSON-LD document to
* compact.
* @param null|string|object|array $context The context.
* @param null|array|object $options Options to configure the
@@ -483,7 +483,7 @@ public static function fromRdf(array $quads, $options = null)
* @param null|array|object $options Options to configure the framing
* process.
*
- * @return mixed The framed JSON-LD document.
+ * @return object The framed JSON-LD document.
*
* @throws JsonLdException
*
View
@@ -56,7 +56,7 @@ public function removeType(NodeInterface $type);
/**
* Get node type
*
- * @return null|NodeInterface|array[NodeInterface] Returns the type(s) of this node.
+ * @return null|NodeInterface|NodeInterface[] Returns the type(s) of this node.
*/
public function getType();
@@ -66,8 +66,8 @@ public function getType();
* This will return all nodes that link to this Node instance via the
* @type (rdf:type) property.
*
- * @return array[NodeInterface] Returns the node(s) having this node as their
- * type.
+ * @return NodeInterface[] Returns the node(s) having this node as their
+ * type.
*/
public function getNodesWithThisType();
@@ -200,9 +200,9 @@ public function getReverseProperties();
*
* @param string $property The name of the reverse property.
*
- * @return null|NodeInterface|array[NodeInterface] Returns the node(s) pointing
- * to this instance via the specified
- * property or null if no such node exists.
+ * @return null|NodeInterface|NodeInterface[] Returns the node(s) pointing
+ * to this instance via the specified
+ * property or null if no such node exists.
*/
public function getReverseProperty($property);
View
@@ -326,10 +326,10 @@ public function getDocument($input)
/**
* Expands a JSON-LD document
*
- * @param mixed $element A JSON-LD element to be expanded.
- * @param array $activectx The active context.
- * @param string $activeprty The active property.
- * @param boolean $frame True if a frame is being expanded, otherwise false.
+ * @param mixed $element A JSON-LD element to be expanded.
+ * @param array $activectx The active context.
+ * @param null|string $activeprty The active property.
+ * @param boolean $frame True if a frame is being expanded, otherwise false.
*
* @return mixed The expanded document.
*
@@ -837,17 +837,17 @@ private function expandValue($value, $activectx, $activeprty)
* Expands a JSON-LD IRI value (term, compact IRI, IRI) to an absolute
* IRI and relabels blank nodes
*
- * @param mixed $value The value to be expanded to an absolute IRI.
- * @param array $activectx The active context.
- * @param bool $relativeIri Specifies whether $value should be treated as
- * relative IRI against the base IRI or not.
- * @param bool $vocabRelative Specifies whether $value is relative to @vocab
- * if set or not.
- * @param object $localctx If the IRI is being expanded as part of context
- * processing, the current local context has to be
- * passed as well.
- * @param array $path A path of already processed terms to detect
- * circular dependencies
+ * @param mixed $value The value to be expanded to an absolute IRI.
+ * @param array $activectx The active context.
+ * @param bool $relativeIri Specifies whether $value should be treated as
+ * relative IRI against the base IRI or not.
+ * @param bool $vocabRelative Specifies whether $value is relative to @vocab
+ * if set or not.
+ * @param null|object $localctx If the IRI is being expanded as part of context
+ * processing, the current local context has to be
+ * passed as well.
+ * @param array $path A path of already processed terms to detect
+ * circular dependencies
*
* @return string The expanded IRI.
*/
@@ -940,10 +940,10 @@ private function expandIri(
* Attention: This method must be called with an expanded element,
* otherwise it might not work.
*
- * @param mixed $element A JSON-LD element to be compacted.
- * @param array $activectx The active context.
- * @param array $inversectx The inverse context.
- * @param string $activeprty The active property.
+ * @param mixed $element A JSON-LD element to be compacted.
+ * @param array $activectx The active context.
+ * @param array $inversectx The inverse context.
+ * @param null|string $activeprty The active property.
*
* @return mixed The compacted JSON-LD document.
*/
@@ -1474,10 +1474,10 @@ private function queryInverseContext($inversectx, $containers, $typeOrLangs, $ty
* If `$only` is set, only the value of that key of the array
* above will be returned.
*
- * @param array $activectx The active context.
- * @param string $property The property.
- * @param string $only If set, only a this element of the definition
- * will be returned.
+ * @param array $activectx The active context.
+ * @param string $property The property.
+ * @param null|string $only If set, only a this element of the
+ * definition will be returned.
*
* @return array|string|null Returns either the property's definition or
* null if not found.
@@ -1876,9 +1876,9 @@ public function createInverseContext($activectx)
* @param object|object[] $element An expanded JSON-LD element to
* be put into the node map
* @param string $activegraph The graph currently being processed.
- * @param string $activeid The node currently being processed.
- * @param string $activeprty The property currently being processed.
- * @param object $list The list object if a list is being
+ * @param null|string $activeid The node currently being processed.
+ * @param null|string $activeprty The property currently being processed.
+ * @param null|object $list The list object if a list is being
* processed.
*/
private function generateNodeMap(
@@ -2040,7 +2040,7 @@ private function generateNodeMap(
* identifier (except null) will thus always return the same blank node
* identifier.
*
- * @param string $id If available, existing blank node identifier.
+ * @param null|string $id If available, existing blank node identifier.
*
* @return string Returns a blank node identifier.
*/
@@ -2446,8 +2446,8 @@ private function createListObjects($graphs, $usages)
/**
* Frames a JSON-LD document according a supplied frame
*
- * @param object $element A JSON-LD element to be framed.
- * @param mixed $frame The frame.
+ * @param array|object $element A JSON-LD element to be framed.
+ * @param mixed $frame The frame.
*
* @return array $result The framed element in expanded form.
*
@@ -2522,13 +2522,13 @@ public function frame($element, $frame)
/**
* Checks whether a node matches a frame or not.
*
- * @param object $node The node.
- * @param object $frame The frame.
- * @param object $options The current framing options.
- * @param object $nodeMap The node map.
- * @param string $graph The currently used graph.
- * @param array $parent The parent to which matching results should be added.
- * @param array $path The path of already processed nodes.
+ * @param object $node The node.
+ * @param null|object $frame The frame.
+ * @param object $options The current framing options.
+ * @param object $nodeMap The node map.
+ * @param string $graph The currently used graph.
+ * @param array $parent The parent to which matching results should be added.
+ * @param array $path The path of already processed nodes.
*
* @return bool Returns true if the node matches the frame, otherwise false.
*/
@@ -2751,7 +2751,7 @@ private function nodeMatchesFrame($node, $frame, $options, $nodeMap, $graph, &$p
* @param object $options The current framing options.
* @param object $nodeMap The node map.
* @param string $graph The currently used graph.
- * @param array $result The object to which the properties should be added.
+ * @param object $result The object to which the properties should be added.
* @param array $path The path of already processed nodes.
*/
private function addMissingNodeProperties($node, $options, $nodeMap, $graph, &$result, $path)
View
@@ -52,7 +52,7 @@ class Quad
* @param IRI $subject The subject.
* @param IRI $property The property.
* @param Value|IRI $object The object.
- * @param IRI $graph The graph.
+ * @param null|IRI $graph The graph.
*
* @throws InvalidArgumentException If the object parameter has a wrong type
*/
@@ -133,7 +133,7 @@ public function getObject()
/**
* Set the graph
*
- * @param IRI $graph The graph
+ * @param null|IRI $graph The graph
*/
public function setGraph(IRI $graph = null)
{
View
@@ -41,10 +41,10 @@ class RemoteDocument
/**
* Constructor
*
- * @param string $documentUrl The final URL of the loaded document.
+ * @param null|string $documentUrl The final URL of the loaded document.
* @param mixed $document The retrieved document (parsed or raw).
- * @param string $mediaType The document's media type.
- * @param string|null $contextUrl The value of the context Link header
+ * @param null|string $mediaType The document's media type.
+ * @param null|string $contextUrl The value of the context Link header
* if available; otherwise null.
*/
public function __construct($documentUrl = null, $document = null, $mediaType = null, $contextUrl = null)
@@ -124,8 +124,8 @@ public function __construct(array $options = array())
/**
* A test ended.
*
- * @param PHPUnit_Framework_Test $test
- * @param float $time
+ * @param \PHPUnit_Framework_Test $test
+ * @param float $time
*/
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
View
@@ -12,6 +12,7 @@
use ML\JsonLD\Processor;
use ML\JsonLD\Document;
use ML\JsonLD\Graph;
+use ML\JsonLD\GraphInterface;
use ML\JsonLD\Node;
use ML\JsonLD\LanguageTaggedString;
use ML\JsonLD\TypedValue;
@@ -27,7 +28,7 @@ class GraphTest extends \PHPUnit_Framework_TestCase
/**
* The graph instance being used throughout the tests.
*
- * @var Graph
+ * @var GraphInterface
*/
protected $graph;
@@ -69,7 +69,7 @@ public function valid()
/**
* Returns the key of the current element.
*
- * @return int The key of the current element
+ * @return string The key of the current element
*/
public function key()
{
@@ -41,9 +41,9 @@ class W3CTestSuiteTest extends JsonTestCase
/**
* Constructs a test case with the given name.
*
- * @param string $name
- * @param array $data
- * @param string $dataName
+ * @param null|string $name
+ * @param array $data
+ * @param string $dataName
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{

0 comments on commit 4b53e13

Please sign in to comment.