Skip to content

Commit 1145e36

Browse files
author
Samuel
committed
Added some doc block comments and coverage config
1 parent e464f66 commit 1145e36

File tree

7 files changed

+36
-32
lines changed

7 files changed

+36
-32
lines changed

.scrutinizer.yml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
filter:
2-
excluded_paths: [tests/*]
2+
excluded_paths: [tests/*]
33

44
checks:
5-
php:
6-
remove_extra_empty_lines: true
7-
remove_php_closing_tag: true
8-
remove_trailing_whitespace: true
9-
fix_use_statements:
10-
remove_unused: true
11-
preserve_multiple: false
12-
preserve_blanklines: true
13-
order_alphabetically: true
14-
fix_php_opening_tag: true
15-
fix_linefeed: true
16-
fix_line_ending: true
17-
fix_identation_4spaces: true
18-
fix_doc_comments: true
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
1919

2020
build:
21-
tests:
21+
nodes:
22+
coverage:
23+
tests:
2224
override:
23-
-
24-
command: 'vendor/bin/phpunit --coverage-clover=some-file'
25-
coverage:
26-
file: 'some-file'
27-
format: 'clover'
25+
-
26+
command: 'vendor/bin/phpunit --coverage-clover=some-file'
27+
coverage:
28+
file: 'some-file'
29+
format: 'clover'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Laravel Json Exception Handler
22

33
[![StyleCI](https://styleci.io/repos/101529653/shield)](https://styleci.io/repos/101529653)
4-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sfelix-martins/json-exception-handler/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sfelix-martins/json-exception-handler/?branch=master)
4+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sfelix-martins/json-exception-handler/badges/quality-score.png?b=2.0)](https://scrutinizer-ci.com/g/sfelix-martins/json-exception-handler/?branch=master)
55

66
Adds methods to your `App\Exceptions\Handler` to treat json responses.
77
It is most useful if you are building APIs!

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php": ">=5.6.4"
14+
"php": ">=7.0.0"
1515
},
1616
"autoload": {
1717
"psr-4": {

src/Handlers/AbstractHandler.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Exception;
66
use InvalidArgumentException;
7-
use SMartins\Exceptions\JsonApi\Error;
87
use Illuminate\Auth\AuthenticationException;
98
use Illuminate\Validation\ValidationException;
109
use SMartins\Exceptions\Response\ErrorHandledInterface;
@@ -60,9 +59,7 @@ public function __construct(Exception $e)
6059
* Handle with an exception according to specific definitions. Returns one
6160
* or more errors using the exception from $exceptions attribute.
6261
*
63-
* @todo Change the return type to any interface to make more extensible.
64-
*
65-
* @return \SMartins\Exceptions\Response\ErrorHandledInterface|\Smartins\Exceptions\Response\ErrorHandledCollectionInterface
62+
* @return ErrorHandledInterface|ErrorHandledCollectionInterface
6663
*/
6764
abstract public function handle();
6865

@@ -85,6 +82,7 @@ public function getCode($type = 'default')
8582
* Return response with handled exception.
8683
*
8784
* @return \SMartins\Exceptions\Response\AbstractResponse
85+
* @throws \SMartins\Exceptions\Response\InvalidContentException
8886
*/
8987
public function handleException()
9088
{
@@ -100,10 +98,10 @@ public function handleException()
10098
/**
10199
* Validate response from handle method of handler class.
102100
*
103-
* @param \SMartins\Exceptions\Response\ErrorHandledInterface|\Smartins\Exceptions\Response\ErrorHandledCollectionInterface
104-
* @return \SMartins\Exceptions\Response\ErrorHandledCollectionInterface
101+
* @param ErrorHandledInterface|ErrorHandledCollectionInterface
102+
* @return ErrorHandledCollectionInterface
105103
*
106-
* @throws \InvalidArgumentException
104+
* @throws \SMartins\Exceptions\Response\InvalidContentException
107105
*/
108106
public function validatedHandledException($error)
109107
{
@@ -216,6 +214,7 @@ public function getResponseHandler()
216214
* Set exception handlers.
217215
*
218216
* @param array $handlers
217+
* @return AbstractHandler
219218
*/
220219
public function setExceptionHandlers(array $handlers)
221220
{

src/Response/ErrorCollectionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function getHeaders();
1818
*
1919
* @param string $statusCode
2020
*
21-
* @return self
21+
* @return static
2222
*/
2323
public function setStatusCode(string $statusCode);
2424

src/Response/ErrorHandledInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface ErrorHandledInterface
99
*
1010
* @todo Maybe pass this method to another interface.
1111
*
12-
* @return \SMartin\Exceptions\Response\ErrorHandledCollectionInterface
12+
* @return \SMartins\Exceptions\Response\ErrorHandledCollectionInterface
1313
*/
1414
public function toCollection(): ErrorHandledCollectionInterface;
1515

tests/GettersAndSetters.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
trait GettersAndSetters
99
{
10+
/**
11+
* @throws \ReflectionException
12+
*/
1013
public function testGettersAndSetters()
1114
{
1215
if (! property_exists($this, 'classToTest')) {

0 commit comments

Comments
 (0)