Skip to content
Snippets Groups Projects
Commit 30a916c2 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

improve SORM docblocks, fixes #2514

Closes #2514

Merge request studip/studip!1703
parent b1144a98
No related branches found
No related tags found
No related merge requests found
...@@ -473,7 +473,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -473,7 +473,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
/** /**
* Returns true if given key exists in the database. * Returns true if given key exists in the database.
* *
* @param string $id primary key * @param string|array $id primary key
* @return boolean * @return boolean
*/ */
public static function exists($id) public static function exists($id)
...@@ -621,7 +621,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -621,7 +621,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
* returns array of instances of given class filtered by given sql * returns array of instances of given class filtered by given sql
* @param string $sql sql clause to use on the right side of WHERE * @param string $sql sql clause to use on the right side of WHERE
* @param ?array $params parameters for query * @param ?array $params parameters for query
* @return array array of "self" objects * @return static[] array of "self" objects
*/ */
public static function findBySQL($sql, $params = []) public static function findBySQL($sql, $params = [])
{ {
...@@ -672,7 +672,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -672,7 +672,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
* *
* @param string $foreign_key_value value of foreign key to find related records * @param string $foreign_key_value value of foreign key to find related records
* @param array $options relation options from other side of relation * @param array $options relation options from other side of relation
* @return array of "self" objects * @return static[] array of "self" objects
*/ */
public static function findThru($foreign_key_value, $options) public static function findThru($foreign_key_value, $options)
{ {
...@@ -754,7 +754,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -754,7 +754,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
* @param ?array $pks array of primary keys * @param ?array $pks array of primary keys
* @param ?string $order order by clause * @param ?string $order order by clause
* @param ?array $order_params * @param ?array $order_params
* @return array * @return static[]
*/ */
public static function findMany($pks = [], $order = '', $order_params = []) public static function findMany($pks = [], $order = '', $order_params = [])
{ {
...@@ -888,7 +888,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -888,7 +888,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
* @param string $name * @param string $name
* @param array $arguments * @param array $arguments
* @throws BadMethodCallException * @throws BadMethodCallException
* @return mixed * @return int|static|static[]
*/ */
public static function __callStatic($name, $arguments) public static function __callStatic($name, $arguments)
{ {
...@@ -1243,7 +1243,6 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -1243,7 +1243,6 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
} }
return true; return true;
} }
return false;
} }
/** /**
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* @category Stud.IP * @category Stud.IP
* *
* @extends SimpleCollection<SimpleORMap> * @extends SimpleCollection<SimpleORMap>
*
* @template T of SimpleORMap
*/ */
class SimpleORMapCollection extends SimpleCollection class SimpleORMapCollection extends SimpleCollection
{ {
...@@ -45,9 +47,9 @@ class SimpleORMapCollection extends SimpleCollection ...@@ -45,9 +47,9 @@ class SimpleORMapCollection extends SimpleCollection
* all objects should be of the same type * all objects should be of the same type
* *
* @throws InvalidArgumentException if first entry is not SimpleOrMap * @throws InvalidArgumentException if first entry is not SimpleOrMap
* @param array<?SimpleORMap> $data array with SimpleORMap objects * @param T[] $data array with SimpleORMap objects
* @param bool $strict check every element for correct type and unique pk * @param bool $strict check every element for correct type and unique pk
* @return SimpleORMapCollection * @return SimpleORMapCollection<T>
*/ */
public static function createFromArray(array $data, $strict = true) public static function createFromArray(array $data, $strict = true)
{ {
...@@ -73,9 +75,9 @@ class SimpleORMapCollection extends SimpleCollection ...@@ -73,9 +75,9 @@ class SimpleORMapCollection extends SimpleCollection
/** /**
* Constructor * Constructor
* *
* @param ?Closure $finder callable to fill collection * @param ?Closure $finder callable to fill collection
* @param ?array $options relationship options * @param ?array $options relationship options
* @param ?SimpleORMap $record related record * @param SimpleORMap|null $record related record
*/ */
public function __construct(Closure $finder = null, array $options = null, SimpleORMap $record = null) public function __construct(Closure $finder = null, array $options = null, SimpleORMap $record = null)
{ {
...@@ -175,7 +177,7 @@ class SimpleORMapCollection extends SimpleCollection ...@@ -175,7 +177,7 @@ class SimpleORMapCollection extends SimpleCollection
* returns element with given primary key value * returns element with given primary key value
* *
* @param string $value primary key value to search for * @param string $value primary key value to search for
* @return ?SimpleORMap * @return ?T
*/ */
public function find($value) public function find($value)
{ {
...@@ -217,7 +219,7 @@ class SimpleORMapCollection extends SimpleCollection ...@@ -217,7 +219,7 @@ class SimpleORMapCollection extends SimpleCollection
* internal deleted collection * internal deleted collection
* *
* @param string $id primary key of element * @param string $id primary key of element
* @return number of unsetted elements * @return int number of unsetted elements
*/ */
public function unsetByPk($id) public function unsetByPk($id)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment