@@ -945,19 +945,52 @@ public function forks(int|string $project_id, array $parameters = []): mixed
945945 /**
946946 * @param array $parameters {
947947 *
948- * @var string $namespace The ID or path of the namespace that the project will be forked to
949- * @var string $path The path of the forked project (optional)
950- * @var string $name The name of the forked project (optional)
948+ * @var string $branches Branches to fork (empty for all branches)
949+ * @var string $description The description assigned to the resultant project after forking
950+ * @var bool $mr_default_target_self For forked projects, target merge requests to this project
951+ * @var string $name The name assigned to the resultant project after forking
952+ * @var int $namespace_id The ID of the namespace that the project is forked to
953+ * @var string $namespace_path The path of the namespace that the project is forked to
954+ * @var int|string $namespace deprecated; use namespace_id or namespace_path instead
955+ * @var string $path The path assigned to the resultant project after forking
956+ * @var string $visibility The visibility level assigned to the resultant project after forking
951957 * }
958+ *
959+ * @throws UndefinedOptionsException If an option name is undefined
960+ * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules
952961 */
953962 public function fork (int |string $ project_id , array $ parameters = []): mixed
954963 {
955964 $ resolver = new OptionsResolver ();
956- $ resolver ->setDefined (['namespace ' , 'path ' , 'name ' ]);
957-
958- $ resolved = $ resolver ->resolve ($ parameters );
965+ $ resolver ->setDefined ('branches ' )
966+ ->setAllowedTypes ('branches ' , 'string ' )
967+ ;
968+ $ resolver ->setDefined ('description ' )
969+ ->setAllowedTypes ('description ' , 'string ' )
970+ ;
971+ $ resolver ->setDefined ('mr_default_target_self ' )
972+ ->setAllowedTypes ('mr_default_target_self ' , 'bool ' )
973+ ;
974+ $ resolver ->setDefined ('name ' )
975+ ->setAllowedTypes ('name ' , 'string ' )
976+ ;
977+ $ resolver ->setDefined ('namespace_id ' )
978+ ->setAllowedTypes ('namespace_id ' , 'int ' )
979+ ;
980+ $ resolver ->setDefined ('namespace_path ' )
981+ ->setAllowedTypes ('namespace_path ' , 'string ' )
982+ ;
983+ $ resolver ->setDefined ('namespace ' )
984+ ->setAllowedTypes ('namespace ' , ['int ' , 'string ' ])
985+ ;
986+ $ resolver ->setDefined ('path ' )
987+ ->setAllowedTypes ('path ' , 'string ' )
988+ ;
989+ $ resolver ->setDefined ('visibility ' )
990+ ->setAllowedValues ('visibility ' , ['public ' , 'internal ' , 'private ' ])
991+ ;
959992
960- return $ this ->post ($ this ->getProjectPath ($ project_id , 'fork ' ), $ resolved );
993+ return $ this ->post ($ this ->getProjectPath ($ project_id , 'fork ' ), $ resolver -> resolve ( $ parameters ) );
961994 }
962995
963996 public function createForkRelation (int |string $ project_id , int |string $ forked_project_id ): mixed
0 commit comments