You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Declaring the classes in the Redmine\Api\ namespace as final will allow us to make more future changes without worrying to much about BC.
To achieve this in a FC way we could create new factory methods create(HttpClient $client): self in all API child classes.
class ProjectApi extends AbstractApi
{
finalpublicstaticfunctioncreate(HttpClient$client): self
{
returnnewself($client);
}
/** * @param Client|HttpClient $client */finalpublicfunction__construct($client)
{
if (get_called_class() !== __CLASS__) {
@trigger_error('Extending ' . __CLASS__ . ' is deprecated since v2.x, it will become final in v3.0.0.');
}
if ($clientinstanceof Client) {
$this->client = $client;
}
// Handle HttpClient...
}
}
Using the HttpClient in the API classes makes the AbstractApi obsolete and can be deprecated. Extending it should also trigger a deprecation.
abstractclass AbstractApi
{
/** * @param Client|HttpClient $client */publicfunction__construct($client)
{
@trigger_error(__CLASS__ . ' is deprecated since v2.x and will be removed in v3.0.0.');
// old code...
}
}
Affected classes
Redmine\Api\Attachment
Redmine\Api\CustomField
Redmine\Api\Group
Redmine\Api\Issue
Redmine\Api\IssueCategory
Redmine\Api\IssuePriority
Redmine\Api\IssueRelation
Redmine\Api\IssueStatus
Redmine\Api\Membership
Redmine\Api\News
Redmine\Api\Project
Redmine\Api\Query
Redmine\Api\Role
Redmine\Api\Search
Redmine\Api\TimeEntry
Redmine\Api\TimeEntryActivity
Redmine\Api\Tracker
Redmine\Api\User
Redmine\Api\Version
Redmine\Api\Wiki
Redmine\Api\AbstractApi
The text was updated successfully, but these errors were encountered:
Declaring the classes in the
Redmine\Api\
namespace as final will allow us to make more future changes without worrying to much about BC.To achieve this in a FC way we could create new factory methods
create(HttpClient $client): self
in all API child classes.Using the HttpClient in the API classes makes the AbstractApi obsolete and can be deprecated. Extending it should also trigger a deprecation.
Affected classes
Redmine\Api\Attachment
Redmine\Api\CustomField
Redmine\Api\Group
Redmine\Api\Issue
Redmine\Api\IssueCategory
Redmine\Api\IssuePriority
Redmine\Api\IssueRelation
Redmine\Api\IssueStatus
Redmine\Api\Membership
Redmine\Api\News
Redmine\Api\Project
Redmine\Api\Query
Redmine\Api\Role
Redmine\Api\Search
Redmine\Api\TimeEntry
Redmine\Api\TimeEntryActivity
Redmine\Api\Tracker
Redmine\Api\User
Redmine\Api\Version
Redmine\Api\Wiki
Redmine\Api\AbstractApi
The text was updated successfully, but these errors were encountered: