@@ -215,7 +215,7 @@ |
||
| 215 | 215 | /** |
| 216 | 216 | * Determine the number of attachments. |
| 217 | 217 | * |
| 218 | - * @return boolean |
|
| 218 | + * @return integer |
|
| 219 | 219 | */ |
| 220 | 220 | public function hasAttachments() |
| 221 | 221 | { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | ]); |
| 211 | 211 | |
| 212 | 212 | foreach ($attachments as $attachment) { |
| 213 | - $this->setDynamicTemplate('widget_template', (string)$attachment->rawPreview()); |
|
| 213 | + $this->setDynamicTemplate('widget_template', (string) $attachment->rawPreview()); |
|
| 214 | 214 | |
| 215 | 215 | if (isset($attachableObjects[$attachment->objType()])) { |
| 216 | 216 | $attachment->attachmentType = $attachableObjects[$attachment->objType()]; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | ); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - $num = (int)$num; |
|
| 477 | + $num = (int) $num; |
|
| 478 | 478 | |
| 479 | 479 | if ($num < 0) { |
| 480 | 480 | throw new InvalidArgumentException( |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | ); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - $page = (int)$page; |
|
| 505 | + $page = (int) $page; |
|
| 506 | 506 | |
| 507 | 507 | if ($page < 0) { |
| 508 | 508 | throw new InvalidArgumentException( |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | /** |
| 14 | 14 | * Alias of {@see Attachment::file()}. |
| 15 | 15 | * |
| 16 | - * @return string|null |
|
| 16 | + * @return \Psr\Http\Message\UriInterface|null |
|
| 17 | 17 | */ |
| 18 | 18 | public function src() |
| 19 | 19 | { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Alias of {@see Attachment::thumbnail()} and {@see Attachment::file()}. |
| 14 | 14 | * |
| 15 | - * @return string|null |
|
| 15 | + * @return \Psr\Http\Message\UriInterface|null |
|
| 16 | 16 | */ |
| 17 | 17 | public function src() |
| 18 | 18 | { |
@@ -471,7 +471,7 @@ |
||
| 471 | 471 | /** |
| 472 | 472 | * Retrieve the relationship's group ID. |
| 473 | 473 | * |
| 474 | - * @return mixed |
|
| 474 | + * @return string |
|
| 475 | 475 | */ |
| 476 | 476 | public function group() |
| 477 | 477 | { |
@@ -402,7 +402,7 @@ |
||
| 402 | 402 | ); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - $this->position = (int)$position; |
|
| 405 | + $this->position = (int) $position; |
|
| 406 | 406 | |
| 407 | 407 | return $this; |
| 408 | 408 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | $pivot = $this->modelFactory()->create(Join::class); |
| 70 | 70 | |
| 71 | 71 | if (is_string($data) && strpos($data, '_') > 1) { |
| 72 | - $data = array_combine([ 'obj_type', 'obj_id' ], explode('_', $data, 1)); |
|
| 72 | + $data = array_combine(['obj_type', 'obj_id'], explode('_', $data, 1)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (is_scalar($data)) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ]); |
| 257 | 257 | $rows = $source->dbQuery( |
| 258 | 258 | strtr($sql, $binds), |
| 259 | - [ 'objType' => $row['object_type'] ] |
|
| 259 | + ['objType' => $row['object_type']] |
|
| 260 | 260 | ); |
| 261 | 261 | |
| 262 | 262 | /** @todo Show found rows, confirm deletion of dead relationships */ |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $sql = 'SELECT p.* FROM `%pivotTable` AS p WHERE p.`%sourceType` = :objType;'; |
| 277 | 277 | $rows = $source->dbQuery( |
| 278 | 278 | strtr($sql, $defaultBinds), |
| 279 | - [ 'objType' => $model ] |
|
| 279 | + ['objType' => $model] |
|
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | 282 | /** @todo Explain missing model, confirm deletion of dead relationships */ |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | ]; |
| 395 | 395 | |
| 396 | 396 | if ($ask && $verb) { |
| 397 | - $dead = array_merge([ 'Deleted' => null, 'Failed' => null ], $dead); |
|
| 397 | + $dead = array_merge(['Deleted' => null, 'Failed' => null], $dead); |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $cli = $this->climate(); |
| 618 | 618 | |
| 619 | 619 | if (is_string($this->action)) { |
| 620 | - $opts = [ 'y', 'n', 'r', 'q', '?' ]; |
|
| 620 | + $opts = ['y', 'n', 'r', 'q', '?']; |
|
| 621 | 621 | $help = [ |
| 622 | 622 | '[y]es — delete the attachment', |
| 623 | 623 | '[n]o — don’t delete the attachment', |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | '[q]uit — exit immediately (does not undo previous actions)', |
| 626 | 626 | ]; |
| 627 | 627 | } else { |
| 628 | - $opts = [ 'y', 'a', 'n', 's', 'q', '?' ]; |
|
| 628 | + $opts = ['y', 'a', 'n', 's', 'q', '?']; |
|
| 629 | 629 | $help = [ |
| 630 | 630 | '[y]es — delete this attachment', |
| 631 | 631 | '[a]ll — delete all attachments', |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | { |
| 687 | 687 | $cli = $this->climate(); |
| 688 | 688 | |
| 689 | - $opts = [ 'y', 'n', 'v', '?' ]; |
|
| 689 | + $opts = ['y', 'n', 'v', '?']; |
|
| 690 | 690 | $help = [ |
| 691 | 691 | '[y]es — continue to deletion phase', |
| 692 | 692 | '[n]o — cancel deletion phase', |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | |
| 90 | 90 | $count = count($attachments); |
| 91 | 91 | $i = 0; |
| 92 | - for (; $i<$count; $i++) { |
|
| 92 | + for (; $i < $count; $i++) { |
|
| 93 | 93 | $attachmentId = $attachments[$i]['attachment_id']; |
| 94 | 94 | $position = $attachments[$i]['position']; |
| 95 | 95 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | public function attachments(...$args) |
| 59 | 59 | { |
| 60 | 60 | $attachables = $this->attachableObjects(); |
| 61 | - $attachments = call_user_func_array([ $this, 'getAttachments' ], $args); |
|
| 61 | + $attachments = call_user_func_array([$this, 'getAttachments'], $args); |
|
| 62 | 62 | |
| 63 | 63 | foreach ($attachments as $attachment) { |
| 64 | 64 | if (isset($attachables[$attachment->objType()])) { |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * |
| 325 | 325 | * @param string $type The attachment type. |
| 326 | 326 | * @throws InvalidArgumentException If provided argument is not of type 'string'. |
| 327 | - * @return string |
|
| 327 | + * @return Attachment |
|
| 328 | 328 | */ |
| 329 | 329 | public function setType($type) |
| 330 | 330 | { |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | /** |
| 766 | 766 | * Retrieve the attachment's sub-title. |
| 767 | 767 | * |
| 768 | - * @return Translation|string|null |
|
| 768 | + * @return null|Translation |
|
| 769 | 769 | */ |
| 770 | 770 | public function subtitle() |
| 771 | 771 | { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | /** |
| 776 | 776 | * Retrieve attachment's description. |
| 777 | 777 | * |
| 778 | - * @return Translation|string|null |
|
| 778 | + * @return null|Translation |
|
| 779 | 779 | */ |
| 780 | 780 | public function description() |
| 781 | 781 | { |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | /** |
| 796 | 796 | * Retrieve the path to the thumbnail associated with the object. |
| 797 | 797 | * |
| 798 | - * @return string|null |
|
| 798 | + * @return string |
|
| 799 | 799 | */ |
| 800 | 800 | public function thumbnail() |
| 801 | 801 | { |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | /** |
| 839 | 839 | * Retrieve the file label. |
| 840 | 840 | * |
| 841 | - * @return string|null |
|
| 841 | + * @return null|Translation |
|
| 842 | 842 | */ |
| 843 | 843 | public function fileLabel() |
| 844 | 844 | { |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | /** |
| 849 | 849 | * Retrieve the link label. |
| 850 | 850 | * |
| 851 | - * @return string|null |
|
| 851 | + * @return null|Translation |
|
| 852 | 852 | */ |
| 853 | 853 | public function linkLabel() |
| 854 | 854 | { |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | /** |
| 896 | - * @return ModelInterface|mixed |
|
| 896 | + * @return ModelInterface |
|
| 897 | 897 | */ |
| 898 | 898 | public function presenter() |
| 899 | 899 | { |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | * Prepend the base URI to the given path. |
| 1002 | 1002 | * |
| 1003 | 1003 | * @param string $text A string to parse relative URIs. |
| 1004 | - * @return UriInterface|null |
|
| 1004 | + * @return string |
|
| 1005 | 1005 | */ |
| 1006 | 1006 | protected function resolveUrls($text) |
| 1007 | 1007 | { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | parent::__construct($data); |
| 198 | 198 | |
| 199 | - if (is_callable([ $this, 'defaultData' ])) { |
|
| 199 | + if (is_callable([$this, 'defaultData'])) { |
|
| 200 | 200 | $defaultData = $this->metadata()->defaultData(); |
| 201 | 201 | if ($defaultData) { |
| 202 | 202 | $this->setData($defaultData); |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | public function heading() |
| 374 | 374 | { |
| 375 | - $heading = $this->render((string)$this->heading); |
|
| 375 | + $heading = $this->render((string) $this->heading); |
|
| 376 | 376 | |
| 377 | 377 | if (!$heading) { |
| 378 | 378 | $heading = $this->translator()->translation('{{ objType }} #{{ id }}', [ |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | public function preview() |
| 416 | 416 | { |
| 417 | 417 | if ($this->preview) { |
| 418 | - return $this->render((string)$this->preview); |
|
| 418 | + return $this->render((string) $this->preview); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return ''; |
@@ -1008,19 +1008,19 @@ discard block |
||
| 1008 | 1008 | static $search; |
| 1009 | 1009 | |
| 1010 | 1010 | if ($search === null) { |
| 1011 | - $attr = [ 'href', 'link', 'url', 'src' ]; |
|
| 1012 | - $scheme = [ '../', './', '/', 'data', 'mailto', 'http' ]; |
|
| 1011 | + $attr = ['href', 'link', 'url', 'src']; |
|
| 1012 | + $scheme = ['../', './', '/', 'data', 'mailto', 'http']; |
|
| 1013 | 1013 | |
| 1014 | 1014 | $search = sprintf( |
| 1015 | 1015 | '(?<=%1$s=")(?!%2$s)(\S+)(?=")', |
| 1016 | - implode('="|', array_map('preg_quote', $attr, [ '~' ])), |
|
| 1017 | - implode('|', array_map('preg_quote', $scheme, [ '~' ])) |
|
| 1016 | + implode('="|', array_map('preg_quote', $attr, ['~'])), |
|
| 1017 | + implode('|', array_map('preg_quote', $scheme, ['~'])) |
|
| 1018 | 1018 | ); |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | $text = preg_replace_callback( |
| 1022 | 1022 | '~'.$search.'~i', |
| 1023 | - function ($matches) { |
|
| 1023 | + function($matches) { |
|
| 1024 | 1024 | return $this->createAbsoluteUrl($matches[1]); |
| 1025 | 1025 | }, |
| 1026 | 1026 | $text |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | protected function isRelativeUri($uri) |
| 1040 | 1040 | { |
| 1041 | 1041 | if ($uri && !parse_url($uri, PHP_URL_SCHEME)) { |
| 1042 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
| 1042 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
| 1043 | 1043 | return true; |
| 1044 | 1044 | } |
| 1045 | 1045 | } |