36
36
* Note: This extension relies on the object also having the {@see Ownership} extension applied.
37
37
*
38
38
* @property int $Version
39
- * @property DataObject|RecursivePublishable|Versioned $owner
40
39
* @mixin RecursivePublishable
40
+ *
41
+ * @extends DataExtension<DataObject&RecursivePublishable&Versioned>
41
42
*/
42
43
class Versioned extends DataExtension implements TemplateGlobalProvider, Resettable
43
44
{
@@ -2018,7 +2019,7 @@ public function stagesDifferRecursive(): bool
2018
2019
* @param string $join Deprecated, use leftJoin($table, $joinClause) instead
2019
2020
* @param string $having @deprecated 2.2.0 The $having parameter does nothing and will be removed without
2020
2021
* equivalent functionality to replace it
2021
- * @return ArrayList
2022
+ * @return ArrayList<Versioned_Version>
2022
2023
*/
2023
2024
public function Versions ($ filter = "" , $ sort = "" , $ limit = "" , $ join = "" , $ having = "" )
2024
2025
{
@@ -2363,13 +2364,13 @@ public static function reading_archived_date($date, $stage = self::DRAFT)
2363
2364
/**
2364
2365
* Get a singleton instance of a class in the given stage.
2365
2366
*
2366
- * @param string $class The name of the class.
2367
+ * @template T of DataObject
2368
+ * @param class-string<T> $class The name of the class.
2367
2369
* @param string $stage The name of the stage.
2368
2370
* @param string $filter A filter to be inserted into the WHERE clause.
2369
2371
* @param boolean $cache Use caching.
2370
2372
* @param string $sort A sort expression to be inserted into the ORDER BY clause.
2371
- *
2372
- * @return DataObject
2373
+ * @return T&Versioned
2373
2374
*/
2374
2375
public static function get_one_by_stage ($ class , $ stage , $ filter = '' , $ cache = true , $ sort = '' )
2375
2376
{
@@ -2519,15 +2520,16 @@ public static function prepopulate_versionnumber_cache($class, $stage, $idList =
2519
2520
/**
2520
2521
* Get a set of class instances by the given stage.
2521
2522
*
2522
- * @param string $class The name of the class.
2523
+ * @template T of DataObject
2524
+ * @param class-string<T> $class The name of the class.
2523
2525
* @param string $stage The name of the stage.
2524
2526
* @param string $filter A filter to be inserted into the WHERE clause.
2525
2527
* @param string $sort A sort expression to be inserted into the ORDER BY clause.
2526
2528
* @param string $join Deprecated, use leftJoin($table, $joinClause) instead
2527
2529
* @param int $limit A limit on the number of records returned from the database.
2528
2530
* @param string $containerClass The container class for the result set (default is DataList)
2529
2531
*
2530
- * @return DataList A modified DataList designated to the specified stage
2532
+ * @return DataList<T> A modified DataList designated to the specified stage
2531
2533
*/
2532
2534
public static function get_by_stage (
2533
2535
$ class ,
@@ -2657,9 +2659,10 @@ public function rollbackSingle($version)
2657
2659
/**
2658
2660
* Return the latest version of the given record.
2659
2661
*
2660
- * @param string $class
2662
+ * @template T of DataObject
2663
+ * @param class-string<T> $class
2661
2664
* @param int $id
2662
- * @return DataObject
2665
+ * @return T&Versioned
2663
2666
*/
2664
2667
public static function get_latest_version ($ class , $ id )
2665
2668
{
@@ -2687,7 +2690,6 @@ public function isLatestVersion()
2687
2690
return false ;
2688
2691
}
2689
2692
2690
- /** @var Versioned|DataObject $version */
2691
2693
$ version = static ::get_latest_version ($ this ->owner ->baseClass (), $ owner ->ID );
2692
2694
return ($ version ->Version == $ owner ->Version );
2693
2695
}
@@ -2826,10 +2828,11 @@ public function isModifiedOnDraft()
2826
2828
*
2827
2829
* In particular, this will query deleted records as well as active ones.
2828
2830
*
2829
- * @param string $class
2831
+ * @template T of DataObject
2832
+ * @param class-string<T> $class
2830
2833
* @param string $filter
2831
2834
* @param string $sort
2832
- * @return DataList
2835
+ * @return DataList<T>
2833
2836
*/
2834
2837
public static function get_including_deleted ($ class , $ filter = "" , $ sort = "" )
2835
2838
{
@@ -2851,11 +2854,11 @@ public static function get_including_deleted($class, $filter = "", $sort = "")
2851
2854
* modifications via write() will create a new version, rather than
2852
2855
* modifying the existing one.
2853
2856
*
2854
- * @param string $class
2857
+ * @template T of DataObject
2858
+ * @param class-string<T> $class
2855
2859
* @param int $id
2856
2860
* @param int $version
2857
- *
2858
- * @return DataObject
2861
+ * @return T&Versioned
2859
2862
*/
2860
2863
public static function get_version ($ class , $ id , $ version )
2861
2864
{
@@ -2872,10 +2875,11 @@ public static function get_version($class, $id, $version)
2872
2875
/**
2873
2876
* Return a list of all versions for a given id.
2874
2877
*
2875
- * @param string $class
2878
+ * @template T
2879
+ * @param class-string<T> $class
2876
2880
* @param int $id
2877
2881
*
2878
- * @return DataList
2882
+ * @return DataList<T>
2879
2883
*/
2880
2884
public static function get_all_versions ($ class , $ id )
2881
2885
{
0 commit comments