Skip to content

Commit d24c81f

Browse files
committed
phpdoc: update/corrent references
Makes working with IDEs more pleasant
1 parent 4347853 commit d24c81f

File tree

7 files changed

+55
-42
lines changed

7 files changed

+55
-42
lines changed

src/EchoIt/JsonApi/ErrorResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ErrorResponse extends JsonResponse
1515
* @param int $httpStatusCode HTTP status code
1616
* @param mixed $errorCode Internal error code
1717
* @param string $errorTitle Error description
18+
* @param array $additionalAttrs
1819
*/
1920
public function __construct($httpStatusCode, $errorCode, $errorTitle, array $additionalAttrs = array())
2021
{

src/EchoIt/JsonApi/Exception.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Exception extends \Exception
1616
* @param string $message The Exception message to throw
1717
* @param int $code The Exception code
1818
* @param int $httpStatusCode HTTP status code which can be used for broken request
19+
* @param array $additionalAttrs
1920
*/
2021
public function __construct($message = '', $code = 0, $httpStatusCode = 500, array $additionalAttrs = array())
2122
{
@@ -28,7 +29,7 @@ public function __construct($message = '', $code = 0, $httpStatusCode = 500, arr
2829
/**
2930
* This method returns a HTTP response representation of the Exception
3031
*
31-
* @return JsonApi\ErrorResponse
32+
* @return \EchoIt\JsonApi\ErrorResponse
3233
*/
3334
public function response()
3435
{

src/EchoIt/JsonApi/Exception/Validation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class Validation extends Exception
1717
/**
1818
* Constructor.
1919
*
20-
* @param string $message The Exception message to throw
21-
* @param int $code The Exception code
22-
* @param int $httpStatusCode HTTP status code which can be used for broken request
23-
* @param Illuminate\Support\MessageBag $messages Validation errors
20+
* @param string $message The Exception message to throw
21+
* @param int $code The Exception code
22+
* @param int $httpStatusCode HTTP status code which can be used for broken request
23+
* @param \Illuminate\Support\MessageBag $messages Validation errors
2424
*/
2525
public function __construct($message = '', $code = 0, $httpStatusCode = 500, ValidationMessages $messages = NULL)
2626
{
@@ -33,7 +33,7 @@ public function __construct($message = '', $code = 0, $httpStatusCode = 500, Val
3333
/**
3434
* This method returns a HTTP response representation of the Exception
3535
*
36-
* @return JsonApi\MultiErrorResponse
36+
* @return \EchoIt\JsonApi\MultiErrorResponse
3737
*/
3838
public function response()
3939
{

src/EchoIt/JsonApi/Handler.php

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract class Handler
3636
/**
3737
* Constructor.
3838
*
39-
* @param JsonApi\Request $request
39+
* @param \EchoIt\JsonApi\Request $request
4040
*/
4141
public function __construct(Request $request)
4242
{
@@ -57,7 +57,8 @@ public function supportsMethod($method)
5757
/**
5858
* Fulfill the API request and return a response.
5959
*
60-
* @return JsonApi\Response
60+
* @return \EchoIT\JsonApi\Response
61+
* @throws Exception
6162
*/
6263
public function fulfillRequest()
6364
{
@@ -135,6 +136,7 @@ protected function loadRelatedModels(Model $model) {
135136
/**
136137
* Returns which requested resources are available to include.
137138
*
139+
* @param Model $model
138140
* @return array
139141
*/
140142
protected function exposedRelationsFromRequest($model = null)
@@ -174,7 +176,7 @@ protected function unknownRelationsFromRequest()
174176
/**
175177
* Iterate through result set to fetch the requested resources to include.
176178
*
177-
* @param Illuminate\Database\Eloquent\Collection|JsonApi\Model $models
179+
* @param \Illuminate\Database\Eloquent\Collection|\EchoIT\JsonApi\Model $models
178180
* @return array
179181
*/
180182
protected function getIncludedModels($models)
@@ -315,9 +317,10 @@ protected static function methodHandlerName($method)
315317
/**
316318
* Returns the models from a relationship. Will always return as array.
317319
*
318-
* @param Illuminate\Database\Eloquent\Model $model
320+
* @param \Illuminate\Database\Eloquent\Model $model
319321
* @param string $relationKey
320-
* @return array|Illuminate\Database\Eloquent\Collection
322+
* @return array|\Illuminate\Database\Eloquent\Collection
323+
* @throws Exception
321324
*/
322325
protected static function getModelsForRelation($model, $relationKey)
323326
{
@@ -346,7 +349,7 @@ protected static function getModelsForRelation($model, $relationKey)
346349
*
347350
* @param array &$array
348351
* @param string $key
349-
* @return Illuminate\Database\Eloquent\Collection
352+
* @return \Illuminate\Database\Eloquent\Collection
350353
*/
351354
protected static function getCollectionOrCreate(&$array, $key)
352355
{
@@ -374,8 +377,9 @@ protected static function getModelNameForRelation($relationName)
374377
* Function to handle sorting requests.
375378
*
376379
* @param array $cols list of column names to sort on
377-
* @param EchoIt\JsonApi\Model $model
378-
* @return EchoIt\JsonApi\Model
380+
* @param \EchoIt\JsonApi\Model $model
381+
* @return \EchoIt\JsonApi\Model
382+
* @throws Exception
379383
*/
380384
protected function handleSortRequest($cols, $model)
381385
{
@@ -404,6 +408,7 @@ protected function handleSortRequest($cols, $model)
404408
* @param string $content
405409
* @param string $type the type the content is expected to be.
406410
* @return array
411+
* @throws Exception
407412
*/
408413
protected function parseRequestContent($content, $type)
409414
{
@@ -439,10 +444,10 @@ protected function parseRequestContent($content, $type)
439444
/**
440445
* Function to handle pagination requests.
441446
*
442-
* @param EchoIt\JsonApi\Request $request
443-
* @param EchoIt\JsonApi\Model $model
447+
* @param \EchoIt\JsonApi\Request $request
448+
* @param \EchoIt\JsonApi\Model $model
444449
* @param integer $total the total number of records
445-
* @return Illuminate\Pagination\LengthAwarePaginator
450+
* @return \Illuminate\Pagination\LengthAwarePaginator
446451
*/
447452
protected function handlePaginationRequest($request, $model, $total = null)
448453
{
@@ -473,8 +478,8 @@ protected function handlePaginationRequest($request, $model, $total = null)
473478
* Function to handle filtering requests.
474479
*
475480
* @param array $filters key=>value pairs of column and value to filter on
476-
* @param EchoIt\JsonApi\Model $model
477-
* @return EchoIt\JsonApi\Model
481+
* @param \EchoIt\JsonApi\Model $model
482+
* @return \EchoIt\JsonApi\Model
478483
*/
479484
protected function handleFilterRequest($filters, $model)
480485
{
@@ -488,9 +493,10 @@ protected function handleFilterRequest($filters, $model)
488493
* Default handling of GET request.
489494
* Must be called explicitly in handleGet function.
490495
*
491-
* @param EchoIt\JsonApi\Request $request
492-
* @param EchoIt\JsonApi\Model $model
493-
* @return EchoIt\JsonApi\Model|Illuminate\Pagination\LengthAwarePaginator
496+
* @param \EchoIt\JsonApi\Request $request
497+
* @param \EchoIt\JsonApi\Model $model
498+
* @return \EchoIt\JsonApi\Model|\Illuminate\Pagination\LengthAwarePaginator
499+
* @throws Exception
494500
*/
495501
protected function handleGetDefault(Request $request, $model)
496502
{
@@ -531,12 +537,12 @@ protected function handleGetDefault(Request $request, $model)
531537
* Validates passed data against a model
532538
* Validation performed safely and only if model provides rules
533539
*
534-
* @param EchoIt\JsonApi\Model $model model to validate against
535-
* @param Array $values passed array of values
540+
* @param \EchoIt\JsonApi\Model $model model to validate against
541+
* @param Array $values passed array of values
536542
*
537-
* @throws Exception\Validation Exception thrown when validation fails
543+
* @throws Exception\Validation Exception thrown when validation fails
538544
*
539-
* @return Bool true if validation successful
545+
* @return Bool true if validation successful
540546
*/
541547
protected function validateModelData(Model $model, Array $values)
542548
{
@@ -558,9 +564,10 @@ protected function validateModelData(Model $model, Array $values)
558564
* Default handling of POST request.
559565
* Must be called explicitly in handlePost function.
560566
*
561-
* @param EchoIt\JsonApi\Request $request
562-
* @param EchoIt\JsonApi\Model $model
563-
* @return EchoIt\JsonApi\Model
567+
* @param \EchoIt\JsonApi\Request $request
568+
* @param \EchoIt\JsonApi\Model $model
569+
* @return \EchoIt\JsonApi\Model
570+
* @throws Exception
564571
*/
565572
public function handlePostDefault(Request $request, $model)
566573
{
@@ -584,9 +591,10 @@ public function handlePostDefault(Request $request, $model)
584591
* Default handling of PUT request.
585592
* Must be called explicitly in handlePut function.
586593
*
587-
* @param EchoIt\JsonApi\Request $request
588-
* @param EchoIt\JsonApi\Model $model
589-
* @return EchoIt\JsonApi\Model
594+
* @param \EchoIt\JsonApi\Request $request
595+
* @param \EchoIt\JsonApi\Model $model
596+
* @return \EchoIt\JsonApi\Model
597+
* @throws Exception
590598
*/
591599
public function handlePutDefault(Request $request, $model)
592600
{
@@ -639,9 +647,10 @@ public function handlePutDefault(Request $request, $model)
639647
* Default handling of DELETE request.
640648
* Must be called explicitly in handleDelete function.
641649
*
642-
* @param EchoIt\JsonApi\Request $request
643-
* @param EchoIt\JsonApi\Model $model
644-
* @return EchoIt\JsonApi\Model
650+
* @param \EchoIt\JsonApi\Request $request
651+
* @param \EchoIt\JsonApi\Model $model
652+
* @return \EchoIt\JsonApi\Model
653+
* @throws Exception
645654
*/
646655
public function handleDeleteDefault(Request $request, $model)
647656
{

src/EchoIt/JsonApi/Model.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public function relationsFromMethod() {
9494
/**
9595
* mark this model as changed
9696
*
97-
* @return bool
97+
* @param bool $changed
98+
* @return void
9899
*/
99100
public function markChanged($changed = true)
100101
{
@@ -127,7 +128,7 @@ public function getResourceType()
127128
*
128129
* @param Array $values user passed values (request data)
129130
*
130-
* @return bool|Illuminate\Support\MessageBag True on pass, MessageBag of errors on fail
131+
* @return bool|\Illuminate\Support\MessageBag True on pass, MessageBag of errors on fail
131132
*/
132133
public function validateArray(Array $values)
133134
{

src/EchoIt/JsonApi/MultiErrorResponse.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ class MultiErrorResponse extends JsonResponse
1313
/**
1414
* Constructor.
1515
*
16-
* @param int $httpStatusCode HTTP status code
17-
* @param mixed $errorCode Internal error code
18-
* @param string $errorTitle Error description
19-
* @param Illuminate\Support\MessageBag $errors Validation errors
16+
* @param int $httpStatusCode HTTP status code
17+
* @param mixed $errorCode Internal error code
18+
* @param string $errorTitle Error description
19+
* @param \Illuminate\Support\MessageBag $errors Validation errors
2020
*/
2121
public function __construct($httpStatusCode, $errorCode, $errorTitle, ValidationMessages $errors = NULL)
2222
{

src/EchoIt/JsonApi/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Response
3434
* Constructor
3535
*
3636
* @param array|object $body
37+
* @param int $httpStatusCode
3738
*/
3839
public function __construct($body, $httpStatusCode = 200)
3940
{
@@ -60,7 +61,7 @@ public function __set($key, $value)
6061
* Returns a JsonResponse with the set parameters and body.
6162
*
6263
* @param string $bodyKey The key on which to set the main response.
63-
* @return Illuminate\Http\JsonResponse
64+
* @return \Illuminate\Http\JsonResponse
6465
*/
6566
public function toJsonResponse($bodyKey = 'data', $options = 0)
6667
{

0 commit comments

Comments
 (0)