@@ -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 | { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | ]); |
| 208 | 208 | |
| 209 | 209 | foreach ($attachments as $attachment) { |
| 210 | - $GLOBALS['widget_template'] = (string)$attachment->rawPreview(); |
|
| 210 | + $GLOBALS['widget_template'] = (string) $attachment->rawPreview(); |
|
| 211 | 211 | |
| 212 | 212 | if (isset($attachableObjects[$attachment->objType()])) { |
| 213 | 213 | $attachment->attachmentType = $attachableObjects[$attachment->objType()]; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | ); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - $num = (int)$num; |
|
| 476 | + $num = (int) $num; |
|
| 477 | 477 | |
| 478 | 478 | if ($num < 0) { |
| 479 | 479 | throw new InvalidArgumentException( |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | ); |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - $page = (int)$page; |
|
| 504 | + $page = (int) $page; |
|
| 505 | 505 | |
| 506 | 506 | if ($page < 0) { |
| 507 | 507 | 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 | { |
@@ -293,7 +293,7 @@ |
||
| 293 | 293 | * Set the attachment widget. |
| 294 | 294 | * |
| 295 | 295 | * @param AttachmentWidget $widget The widget displaying attachments. |
| 296 | - * @return string |
|
| 296 | + * @return AttachmentAwareTrait |
|
| 297 | 297 | */ |
| 298 | 298 | protected function setAttachmentWidget(AttachmentWidget $widget) |
| 299 | 299 | { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->logger->warning( |
| 81 | 81 | 'AttachmentAwareTrait::attachments() parameters are deprecated. '. |
| 82 | 82 | 'An array of parameters should be used.', |
| 83 | - [ 'package' => 'locomotivemtl/charcoal-attachment' ] |
|
| 83 | + ['package' => 'locomotivemtl/charcoal-attachment'] |
|
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | 86 | $options = [ |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $loader->setDynamicTypeField('type'); |
| 182 | 182 | |
| 183 | 183 | if ($widget instanceof AttachmentWidget) { |
| 184 | - $callable = function (&$att) use ($widget, $before) { |
|
| 184 | + $callable = function(&$att) use ($widget, $before) { |
|
| 185 | 185 | if ($this instanceof AttachableInterface) { |
| 186 | 186 | $att->setContainerObj($this); |
| 187 | 187 | } |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | $att->isPresentable(true); |
| 209 | 209 | |
| 210 | 210 | if ($before !== null) { |
| 211 | - call_user_func_array($before, [ &$att ]); |
|
| 211 | + call_user_func_array($before, [&$att]); |
|
| 212 | 212 | } |
| 213 | 213 | }; |
| 214 | 214 | } else { |
| 215 | - $callable = function (&$att) use ($before) { |
|
| 215 | + $callable = function(&$att) use ($before) { |
|
| 216 | 216 | if ($this instanceof AttachableInterface) { |
| 217 | 217 | $att->setContainerObj($this); |
| 218 | 218 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $att->isPresentable(true); |
| 221 | 221 | |
| 222 | 222 | if ($before !== null) { |
| 223 | - call_user_func_array($before, [ &$att ]); |
|
| 223 | + call_user_func_array($before, [&$att]); |
|
| 224 | 224 | } |
| 225 | 225 | }; |
| 226 | 226 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $this->logger->warning( |
| 295 | 295 | 'AttachmentAwareTrait::removeJoins() is deprecated. '. |
| 296 | 296 | 'Use AttachmentAwareTrait::removeAttachmentJoins() instead.', |
| 297 | - [ 'package' => 'locomotivemtl/charcoal-attachment' ] |
|
| 297 | + ['package' => 'locomotivemtl/charcoal-attachment'] |
|
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | 300 | return $this->removeAttachmentJoins(); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | $defaults = $this->getDefaultAttachmentOptions(); |
| 423 | 423 | |
| 424 | 424 | $options = array_intersect_key($options, $defaults); |
| 425 | - $options = array_filter($options, [ $this, 'filterAttachmentOption' ], ARRAY_FILTER_USE_BOTH); |
|
| 425 | + $options = array_filter($options, [$this, 'filterAttachmentOption'], ARRAY_FILTER_USE_BOTH); |
|
| 426 | 426 | $options = array_replace($defaults, $options); |
| 427 | 427 | |
| 428 | 428 | return $options; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * |
| 36 | 36 | * @param ConfigInterface|array $config The datas to set. |
| 37 | 37 | * @throws InvalidArgumentException If the parameter is invalid. |
| 38 | - * @return ConfigurableInterface Chainable |
|
| 38 | + * @return ConfigurableAttachmentsTrait Chainable |
|
| 39 | 39 | */ |
| 40 | 40 | public function setConfig($config) |
| 41 | 41 | { |
@@ -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)) { |
@@ -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 | } |
@@ -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 | |