Skip to content

Commit

Permalink
Coding style updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianBeiner committed Nov 29, 2019
1 parent ba55ab9 commit cc3b4d7
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 34 deletions.
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ disabled:
- unalign_equals
- concat_without_spaces
- phpdoc_separation
- phpdoc_no_package
13 changes: 6 additions & 7 deletions src/FabianBeiner/Todoist/TodoistClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@

namespace FabianBeiner\Todoist;

use Exception;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\RequestOptions;

use function strlen;

/**
* Class TodoistClient.
*
* @package FabianBeiner\Todoist
*/
class TodoistClient extends GuzzleClient
{
Expand All @@ -42,7 +41,7 @@ class TodoistClient extends GuzzleClient
* @param string $apiToken The API token to access the Todoist API.
* @param array $config Configuration to be passed to Guzzle client.
*
* @throws TodoistException
* @throws \FabianBeiner\Todoist\TodoistException
*/
public function __construct(string $apiToken, array $config = [])
{
Expand Down Expand Up @@ -73,8 +72,8 @@ public function __construct(string $apiToken, array $config = [])
* @param string $uri
* @param array $options
*
* @throws Exception
* @return PromiseInterface
* @throws \Exception
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function requestAsync($method, $uri = '', array $options = []): PromiseInterface
{
Expand All @@ -101,7 +100,7 @@ protected function prepareRequestData(array $data = []): array
/**
* Validates an ID to be a positive integer.
*
* @param mixed $id
* @param int $id
*
* @return bool
*/
Expand Down
14 changes: 8 additions & 6 deletions src/FabianBeiner/Todoist/TodoistCommentsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

/**
* Trait TodoistCommentsTrait.
*
* @package FabianBeiner\Todoist
*/
trait TodoistCommentsTrait
{
Expand All @@ -33,7 +35,7 @@ public function getAllCommentsByProject(int $projectId)
* @param string $type Can be "project" or "task".
* @param int $typeId ID of the project/task.
*
* @return array|bool Array with all comments (can be empty), or false on failure.
* @return array|bool|mixed Array with all comments (can be empty), or false on failure.
*/
public function getAllComments(string $type, int $typeId)
{
Expand Down Expand Up @@ -61,7 +63,7 @@ public function getAllComments(string $type, int $typeId)
/**
* Validates an ID to be a positive integer.
*
* @param mixed $id
* @param int $id
*
* @return bool
*/
Expand All @@ -72,7 +74,7 @@ abstract protected function validateId($id): bool;
*
* @param int $taskId ID of the task.
*
* @return array|bool Array with all comments (can be empty), or false on failure.
* @return array|bool|mixed Array with all comments (can be empty), or false on failure.
*/
public function getAllCommentsByTask($taskId)
{
Expand All @@ -99,7 +101,7 @@ public function createCommentForProject(int $projectId, string $comment)
* @param int $typeId ID of the project/task.
* @param string $comment Comment to be added.
*
* @return object|bool Object with values of the new comment, or false on failure.
* @return bool|mixed Object with values of the new comment, or false on failure.
*/
public function createComment(string $type, int $typeId, string $comment)
{
Expand Down Expand Up @@ -140,7 +142,7 @@ abstract protected function prepareRequestData(array $data = []): array;
* @param int $taskId ID of the task.
* @param string $comment Comment to be added.
*
* @return object|bool Object with values values of the new comment, or false on failure.
* @return bool|mixed Object with values values of the new comment, or false on failure.
*/
public function createCommentForTask(int $taskId, string $comment)
{
Expand All @@ -152,7 +154,7 @@ public function createCommentForTask(int $taskId, string $comment)
*
* @param int $commentId ID of the comment.
*
* @return object|bool Object with values of the comment, or false on failure.
* @return bool|mixed Object with values of the comment, or false on failure.
*/
public function getComment(int $commentId)
{
Expand Down
2 changes: 2 additions & 0 deletions src/FabianBeiner/Todoist/TodoistException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/**
* Class TodoistException.
*
* @package FabianBeiner\Todoist
*/
class TodoistException extends Exception
{
Expand Down
10 changes: 6 additions & 4 deletions src/FabianBeiner/Todoist/TodoistLabelsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@

/**
* Trait TodoistLabelsTrait.
*
* @package FabianBeiner\Todoist
*/
trait TodoistLabelsTrait
{
/**
* Get all labels.
*
* @return array|bool Array with all labels (can be empty), or false on failure.
* @return array|bool|mixed Array with all labels (can be empty), or false on failure.
*/
public function getAllLabels()
{
Expand All @@ -41,7 +43,7 @@ public function getAllLabels()
*
* @param string $name Name of the label.
*
* @return object|bool Object with values of the new label, or false on failure.
* @return bool|mixed Object with values of the new label, or false on failure.
*/
public function createLabel(string $name)
{
Expand Down Expand Up @@ -74,7 +76,7 @@ abstract protected function prepareRequestData(array $data = []): array;
*
* @param int $labelId ID of the label.
*
* @return object|bool Object with values of the label, or false on failure.
* @return bool|mixed Object with values of the label, or false on failure.
*/
public function getLabel(int $labelId)
{
Expand All @@ -95,7 +97,7 @@ public function getLabel(int $labelId)
/**
* Validates an ID to be a positive integer.
*
* @param mixed $id
* @param int $id
*
* @return bool
*/
Expand Down
10 changes: 6 additions & 4 deletions src/FabianBeiner/Todoist/TodoistProjectsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@

/**
* Trait TodoistProjectsTrait.
*
* @package FabianBeiner\Todoist
*/
trait TodoistProjectsTrait
{
/**
* Get all projects.
*
* @return array|bool Array with all projects (can be empty), or false on failure.
* @return array|bool|mixed Array with all projects (can be empty), or false on failure.
*/
public function getAllProjects()
{
Expand All @@ -41,7 +43,7 @@ public function getAllProjects()
*
* @param string $name Name of the project.
*
* @return object|bool Object with values of the new project, or false on failure.
* @return bool|mixed Object with values of the new project, or false on failure.
*/
public function createProject(string $name)
{
Expand Down Expand Up @@ -74,7 +76,7 @@ abstract protected function prepareRequestData(array $data = []): array;
*
* @param int $projectId ID of the project.
*
* @return object|bool Object with values of the project, or false on failure.
* @return bool|mixed Object with values of the project, or false on failure.
*/
public function getProject(int $projectId)
{
Expand All @@ -95,7 +97,7 @@ public function getProject(int $projectId)
/**
* Validates an ID to be a positive integer.
*
* @param mixed $id
* @param int $id
*
* @return bool
*/
Expand Down
10 changes: 6 additions & 4 deletions src/FabianBeiner/Todoist/TodoistTasksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@

/**
* Trait TodoistTasksTrait.
*
* @package FabianBeiner\Todoist
*/
trait TodoistTasksTrait
{
/**
* Get all tasks.
*
* @return array|bool Array with all tasks (can be empty), or false on failure.
* @return array|bool|mixed Array with all tasks (can be empty), or false on failure.
*/
public function getAllTasks()
{
Expand All @@ -42,7 +44,7 @@ public function getAllTasks()
* @param string $content Content of the task.
* @param array $options Possibility to add non-required parameters.
*
* @return object|bool Object with values of the new task, or false on failure.
* @return bool|mixed Object with values of the new task, or false on failure.
*/
public function createTask(string $content, array $options = [])
{
Expand Down Expand Up @@ -77,7 +79,7 @@ abstract protected function prepareRequestData(array $data = []): array;
*
* @param int $taskId ID of the task.
*
* @return array|bool Array with values of the task, or false on failure.
* @return bool|mixed Array with values of the task, or false on failure.
*/
public function getTask(int $taskId)
{
Expand All @@ -99,7 +101,7 @@ public function getTask(int $taskId)
/**
* Validates an ID to be a positive integer.
*
* @param mixed $id
* @param int $id
*
* @return bool
*/
Expand Down
20 changes: 12 additions & 8 deletions tests/FabianBeiner/Todoist/TodoistClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
namespace FabianBeiner\Todoist\Tests;

use FabianBeiner\Todoist\TodoistClient;
use FabianBeiner\Todoist\TodoistException;
use GuzzleHttp\Psr7\Uri;
use PHPUnit\Framework\TestCase;

/**
* Class TodoistClientTest.
*
* @package FabianBeiner\Todoist\Tests
*/
class TodoistClientTest extends TestCase
{
private $apiToken;
Expand All @@ -29,7 +33,7 @@ public function setUp()
*
* @param array $options
*
* @throws TodoistException
* @throws \FabianBeiner\Todoist\TodoistException
*/
public function testConfiguration(array $options = [])
{
Expand All @@ -47,7 +51,7 @@ public function testConfiguration(array $options = [])
}

/**
* @throws TodoistException
* @throws \FabianBeiner\Todoist\TodoistException
*/
public function testGetAllProjects()
{
Expand All @@ -57,8 +61,8 @@ public function testGetAllProjects()
}

/**
* @throws TodoistException
* @return int ID of the created project.
* @throws \FabianBeiner\Todoist\TodoistException
* @return mixed ID of the created project.
*/
public function testCreateProject()
{
Expand All @@ -75,7 +79,7 @@ public function testCreateProject()
*
* @param $id
*
* @throws TodoistException
* @throws \FabianBeiner\Todoist\TodoistException
*/
public function testGetProject($id)
{
Expand All @@ -89,7 +93,7 @@ public function testGetProject($id)
*
* @param $id
*
* @throws TodoistException
* @throws \FabianBeiner\Todoist\TodoistException
*/
public function testUpdateProject($id)
{
Expand All @@ -103,7 +107,7 @@ public function testUpdateProject($id)
*
* @param $id
*
* @throws TodoistException
* @throws \FabianBeiner\Todoist\TodoistException
*/
public function testDeleteProject($id)
{
Expand Down
4 changes: 3 additions & 1 deletion tests/FabianBeiner/Todoist/TodoistExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* Class TodoistExceptionTest.
*
* @package FabianBeiner\Todoist\Tests
*/
class TodoistExceptionTest extends TestCase
{
Expand All @@ -19,7 +21,7 @@ public function testInstantiation()
}

/**
* @expectedException TodoistException
* @expectedException \FabianBeiner\Todoist\TodoistException
* @expectedExceptionMessage Some message.
*/
public function testTodoistExceptionThrowable()
Expand Down

0 comments on commit cc3b4d7

Please sign in to comment.