Skip to content

Commit cc3b4d7

Browse files
committed
Coding style updates.
1 parent ba55ab9 commit cc3b4d7

File tree

9 files changed

+50
-34
lines changed

9 files changed

+50
-34
lines changed

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ disabled:
1414
- unalign_equals
1515
- concat_without_spaces
1616
- phpdoc_separation
17+
- phpdoc_no_package

src/FabianBeiner/Todoist/TodoistClient.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111

1212
namespace FabianBeiner\Todoist;
1313

14-
use Exception;
1514
use GuzzleHttp\Client as GuzzleClient;
1615
use GuzzleHttp\Promise\PromiseInterface;
1716
use GuzzleHttp\RequestOptions;
1817

19-
use function strlen;
20-
2118
/**
2219
* Class TodoistClient.
20+
*
21+
* @package FabianBeiner\Todoist
2322
*/
2423
class TodoistClient extends GuzzleClient
2524
{
@@ -42,7 +41,7 @@ class TodoistClient extends GuzzleClient
4241
* @param string $apiToken The API token to access the Todoist API.
4342
* @param array $config Configuration to be passed to Guzzle client.
4443
*
45-
* @throws TodoistException
44+
* @throws \FabianBeiner\Todoist\TodoistException
4645
*/
4746
public function __construct(string $apiToken, array $config = [])
4847
{
@@ -73,8 +72,8 @@ public function __construct(string $apiToken, array $config = [])
7372
* @param string $uri
7473
* @param array $options
7574
*
76-
* @throws Exception
77-
* @return PromiseInterface
75+
* @throws \Exception
76+
* @return \GuzzleHttp\Promise\PromiseInterface
7877
*/
7978
public function requestAsync($method, $uri = '', array $options = []): PromiseInterface
8079
{
@@ -101,7 +100,7 @@ protected function prepareRequestData(array $data = []): array
101100
/**
102101
* Validates an ID to be a positive integer.
103102
*
104-
* @param mixed $id
103+
* @param int $id
105104
*
106105
* @return bool
107106
*/

src/FabianBeiner/Todoist/TodoistCommentsTrait.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
/**
1414
* Trait TodoistCommentsTrait.
15+
*
16+
* @package FabianBeiner\Todoist
1517
*/
1618
trait TodoistCommentsTrait
1719
{
@@ -33,7 +35,7 @@ public function getAllCommentsByProject(int $projectId)
3335
* @param string $type Can be "project" or "task".
3436
* @param int $typeId ID of the project/task.
3537
*
36-
* @return array|bool Array with all comments (can be empty), or false on failure.
38+
* @return array|bool|mixed Array with all comments (can be empty), or false on failure.
3739
*/
3840
public function getAllComments(string $type, int $typeId)
3941
{
@@ -61,7 +63,7 @@ public function getAllComments(string $type, int $typeId)
6163
/**
6264
* Validates an ID to be a positive integer.
6365
*
64-
* @param mixed $id
66+
* @param int $id
6567
*
6668
* @return bool
6769
*/
@@ -72,7 +74,7 @@ abstract protected function validateId($id): bool;
7274
*
7375
* @param int $taskId ID of the task.
7476
*
75-
* @return array|bool Array with all comments (can be empty), or false on failure.
77+
* @return array|bool|mixed Array with all comments (can be empty), or false on failure.
7678
*/
7779
public function getAllCommentsByTask($taskId)
7880
{
@@ -99,7 +101,7 @@ public function createCommentForProject(int $projectId, string $comment)
99101
* @param int $typeId ID of the project/task.
100102
* @param string $comment Comment to be added.
101103
*
102-
* @return object|bool Object with values of the new comment, or false on failure.
104+
* @return bool|mixed Object with values of the new comment, or false on failure.
103105
*/
104106
public function createComment(string $type, int $typeId, string $comment)
105107
{
@@ -140,7 +142,7 @@ abstract protected function prepareRequestData(array $data = []): array;
140142
* @param int $taskId ID of the task.
141143
* @param string $comment Comment to be added.
142144
*
143-
* @return object|bool Object with values values of the new comment, or false on failure.
145+
* @return bool|mixed Object with values values of the new comment, or false on failure.
144146
*/
145147
public function createCommentForTask(int $taskId, string $comment)
146148
{
@@ -152,7 +154,7 @@ public function createCommentForTask(int $taskId, string $comment)
152154
*
153155
* @param int $commentId ID of the comment.
154156
*
155-
* @return object|bool Object with values of the comment, or false on failure.
157+
* @return bool|mixed Object with values of the comment, or false on failure.
156158
*/
157159
public function getComment(int $commentId)
158160
{

src/FabianBeiner/Todoist/TodoistException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Class TodoistException.
17+
*
18+
* @package FabianBeiner\Todoist
1719
*/
1820
class TodoistException extends Exception
1921
{

src/FabianBeiner/Todoist/TodoistLabelsTrait.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212

1313
/**
1414
* Trait TodoistLabelsTrait.
15+
*
16+
* @package FabianBeiner\Todoist
1517
*/
1618
trait TodoistLabelsTrait
1719
{
1820
/**
1921
* Get all labels.
2022
*
21-
* @return array|bool Array with all labels (can be empty), or false on failure.
23+
* @return array|bool|mixed Array with all labels (can be empty), or false on failure.
2224
*/
2325
public function getAllLabels()
2426
{
@@ -41,7 +43,7 @@ public function getAllLabels()
4143
*
4244
* @param string $name Name of the label.
4345
*
44-
* @return object|bool Object with values of the new label, or false on failure.
46+
* @return bool|mixed Object with values of the new label, or false on failure.
4547
*/
4648
public function createLabel(string $name)
4749
{
@@ -74,7 +76,7 @@ abstract protected function prepareRequestData(array $data = []): array;
7476
*
7577
* @param int $labelId ID of the label.
7678
*
77-
* @return object|bool Object with values of the label, or false on failure.
79+
* @return bool|mixed Object with values of the label, or false on failure.
7880
*/
7981
public function getLabel(int $labelId)
8082
{
@@ -95,7 +97,7 @@ public function getLabel(int $labelId)
9597
/**
9698
* Validates an ID to be a positive integer.
9799
*
98-
* @param mixed $id
100+
* @param int $id
99101
*
100102
* @return bool
101103
*/

src/FabianBeiner/Todoist/TodoistProjectsTrait.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212

1313
/**
1414
* Trait TodoistProjectsTrait.
15+
*
16+
* @package FabianBeiner\Todoist
1517
*/
1618
trait TodoistProjectsTrait
1719
{
1820
/**
1921
* Get all projects.
2022
*
21-
* @return array|bool Array with all projects (can be empty), or false on failure.
23+
* @return array|bool|mixed Array with all projects (can be empty), or false on failure.
2224
*/
2325
public function getAllProjects()
2426
{
@@ -41,7 +43,7 @@ public function getAllProjects()
4143
*
4244
* @param string $name Name of the project.
4345
*
44-
* @return object|bool Object with values of the new project, or false on failure.
46+
* @return bool|mixed Object with values of the new project, or false on failure.
4547
*/
4648
public function createProject(string $name)
4749
{
@@ -74,7 +76,7 @@ abstract protected function prepareRequestData(array $data = []): array;
7476
*
7577
* @param int $projectId ID of the project.
7678
*
77-
* @return object|bool Object with values of the project, or false on failure.
79+
* @return bool|mixed Object with values of the project, or false on failure.
7880
*/
7981
public function getProject(int $projectId)
8082
{
@@ -95,7 +97,7 @@ public function getProject(int $projectId)
9597
/**
9698
* Validates an ID to be a positive integer.
9799
*
98-
* @param mixed $id
100+
* @param int $id
99101
*
100102
* @return bool
101103
*/

src/FabianBeiner/Todoist/TodoistTasksTrait.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212

1313
/**
1414
* Trait TodoistTasksTrait.
15+
*
16+
* @package FabianBeiner\Todoist
1517
*/
1618
trait TodoistTasksTrait
1719
{
1820
/**
1921
* Get all tasks.
2022
*
21-
* @return array|bool Array with all tasks (can be empty), or false on failure.
23+
* @return array|bool|mixed Array with all tasks (can be empty), or false on failure.
2224
*/
2325
public function getAllTasks()
2426
{
@@ -42,7 +44,7 @@ public function getAllTasks()
4244
* @param string $content Content of the task.
4345
* @param array $options Possibility to add non-required parameters.
4446
*
45-
* @return object|bool Object with values of the new task, or false on failure.
47+
* @return bool|mixed Object with values of the new task, or false on failure.
4648
*/
4749
public function createTask(string $content, array $options = [])
4850
{
@@ -77,7 +79,7 @@ abstract protected function prepareRequestData(array $data = []): array;
7779
*
7880
* @param int $taskId ID of the task.
7981
*
80-
* @return array|bool Array with values of the task, or false on failure.
82+
* @return bool|mixed Array with values of the task, or false on failure.
8183
*/
8284
public function getTask(int $taskId)
8385
{
@@ -99,7 +101,7 @@ public function getTask(int $taskId)
99101
/**
100102
* Validates an ID to be a positive integer.
101103
*
102-
* @param mixed $id
104+
* @param int $id
103105
*
104106
* @return bool
105107
*/

tests/FabianBeiner/Todoist/TodoistClientTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
namespace FabianBeiner\Todoist\Tests;
44

55
use FabianBeiner\Todoist\TodoistClient;
6-
use FabianBeiner\Todoist\TodoistException;
76
use GuzzleHttp\Psr7\Uri;
87
use PHPUnit\Framework\TestCase;
98

9+
/**
10+
* Class TodoistClientTest.
11+
*
12+
* @package FabianBeiner\Todoist\Tests
13+
*/
1014
class TodoistClientTest extends TestCase
1115
{
1216
private $apiToken;
@@ -29,7 +33,7 @@ public function setUp()
2933
*
3034
* @param array $options
3135
*
32-
* @throws TodoistException
36+
* @throws \FabianBeiner\Todoist\TodoistException
3337
*/
3438
public function testConfiguration(array $options = [])
3539
{
@@ -47,7 +51,7 @@ public function testConfiguration(array $options = [])
4751
}
4852

4953
/**
50-
* @throws TodoistException
54+
* @throws \FabianBeiner\Todoist\TodoistException
5155
*/
5256
public function testGetAllProjects()
5357
{
@@ -57,8 +61,8 @@ public function testGetAllProjects()
5761
}
5862

5963
/**
60-
* @throws TodoistException
61-
* @return int ID of the created project.
64+
* @throws \FabianBeiner\Todoist\TodoistException
65+
* @return mixed ID of the created project.
6266
*/
6367
public function testCreateProject()
6468
{
@@ -75,7 +79,7 @@ public function testCreateProject()
7579
*
7680
* @param $id
7781
*
78-
* @throws TodoistException
82+
* @throws \FabianBeiner\Todoist\TodoistException
7983
*/
8084
public function testGetProject($id)
8185
{
@@ -89,7 +93,7 @@ public function testGetProject($id)
8993
*
9094
* @param $id
9195
*
92-
* @throws TodoistException
96+
* @throws \FabianBeiner\Todoist\TodoistException
9397
*/
9498
public function testUpdateProject($id)
9599
{
@@ -103,7 +107,7 @@ public function testUpdateProject($id)
103107
*
104108
* @param $id
105109
*
106-
* @throws TodoistException
110+
* @throws \FabianBeiner\Todoist\TodoistException
107111
*/
108112
public function testDeleteProject($id)
109113
{

tests/FabianBeiner/Todoist/TodoistExceptionTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/**
1010
* Class TodoistExceptionTest.
11+
*
12+
* @package FabianBeiner\Todoist\Tests
1113
*/
1214
class TodoistExceptionTest extends TestCase
1315
{
@@ -19,7 +21,7 @@ public function testInstantiation()
1921
}
2022

2123
/**
22-
* @expectedException TodoistException
24+
* @expectedException \FabianBeiner\Todoist\TodoistException
2325
* @expectedExceptionMessage Some message.
2426
*/
2527
public function testTodoistExceptionThrowable()

0 commit comments

Comments
 (0)