Passed
Push — master ( 9f6d99...170861 )
by Chauncey
02:15
created
src/Charcoal/Admin/Widget/AttachmentWidget.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace Charcoal\Admin\Widget;
4 4
 
5
-use ArrayIterator;
6 5
 use Charcoal\Model\ModelInterface;
7 6
 use RuntimeException;
8 7
 use InvalidArgumentException;
@@ -11,7 +10,6 @@  discard block
 block discarded – undo
11 10
 use Pimple\Container;
12 11
 
13 12
 // From 'bobthecow/mustache.php'
14
-use Mustache_LambdaHelper as LambdaHelper;
15 13
 
16 14
 // From 'charcoal-config'
17 15
 use Charcoal\Config\ConfigurableInterface;
@@ -20,7 +18,6 @@  discard block
 block discarded – undo
20 18
 use Charcoal\Factory\FactoryInterface;
21 19
 
22 20
 // From 'charcoal-core'
23
-use Charcoal\Loader\CollectionLoader;
24 21
 
25 22
 // From 'charcoal-translator'
26 23
 use Charcoal\Translator\Translation;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Object/Attachment.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
 // From 'locomotivemtl/charcoal-attachments'
26 26
 use Charcoal\Attachment\Interfaces\AttachableInterface;
27 27
 use Charcoal\Attachment\Interfaces\AttachmentContainerInterface;
28
-
29 28
 use Charcoal\Attachment\Object\File;
30 29
 use Charcoal\Attachment\Object\Image;
31 30
 use Charcoal\Attachment\Object\Text;
Please login to merge, or discard this patch.
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      *
309 309
      * @param  string $type The attachment type.
310 310
      * @throws InvalidArgumentException If provided argument is not of type 'string'.
311
-     * @return string
311
+     * @return Attachment
312 312
      */
313 313
     public function setType($type)
314 314
     {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
      * Show/hide the attachment's title on the front-end.
526 526
      *
527 527
      * @param  boolean $show Show (TRUE) or hide (FALSE) the title.
528
-     * @return UiItemInterface Chainable
528
+     * @return Attachment Chainable
529 529
      */
530 530
     public function setShowTitle($show)
531 531
     {
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
     /**
724 724
      * Retrieve the attachment's sub-title.
725 725
      *
726
-     * @return Translation|string|null
726
+     * @return null|Translation
727 727
      */
728 728
     public function subtitle()
729 729
     {
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
     /**
734 734
      * Retrieve attachment's description.
735 735
      *
736
-     * @return Translation|string|null
736
+     * @return null|Translation
737 737
      */
738 738
     public function description()
739 739
     {
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
     /**
754 754
      * Retrieve the path to the thumbnail associated with the object.
755 755
      *
756
-     * @return string|null
756
+     * @return string
757 757
      */
758 758
     public function thumbnail()
759 759
     {
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
     /**
764 764
      * Retrieve the path to the attached file.
765 765
      *
766
-     * @return Translation|string|null
766
+     * @return File
767 767
      */
768 768
     public function file()
769 769
     {
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     /**
774 774
      * Retrieve the attached link.
775 775
      *
776
-     * @return Translation|string|null
776
+     * @return null|Translation
777 777
      */
778 778
     public function link()
779 779
     {
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
      * Prepend the base URI to the given path.
921 921
      *
922 922
      * @param  string $text A string to parse relative URIs.
923
-     * @return UriInterface|null
923
+     * @return string
924 924
      */
925 925
     protected function resolveUrls($text)
926 926
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         parent::__construct($data);
182 182
 
183
-        if (is_callable([ $this, 'defaultData' ])) {
183
+        if (is_callable([$this, 'defaultData'])) {
184 184
             $defaultData = $this->defaultData();
185 185
             if ($defaultData) {
186 186
                 $this->setData($defaultData);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function heading()
358 358
     {
359
-        $heading = $this->render((string)$this->heading);
359
+        $heading = $this->render((string) $this->heading);
360 360
 
361 361
         if (!$heading) {
362 362
             $heading = $this->translator()->translation('{{ objType }} #{{ id }}', [
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     public function preview()
400 400
     {
401 401
         if ($this->preview) {
402
-            return $this->render((string)$this->preview);
402
+            return $this->render((string) $this->preview);
403 403
         }
404 404
 
405 405
         return '';
@@ -927,19 +927,19 @@  discard block
 block discarded – undo
927 927
         static $search;
928 928
 
929 929
         if ($search === null) {
930
-            $attr   = [ 'href', 'link', 'url', 'src' ];
931
-            $scheme = [ '../', './', '/', 'data', 'mailto', 'http' ];
930
+            $attr   = ['href', 'link', 'url', 'src'];
931
+            $scheme = ['../', './', '/', 'data', 'mailto', 'http'];
932 932
 
933 933
             $search = sprintf(
934 934
                 '(?<=%1$s=")(?!%2$s)(\S+)(?=")',
935
-                implode('="|', array_map('preg_quote', $attr, [ '~' ])),
936
-                implode('|', array_map('preg_quote', $scheme, [ '~' ]))
935
+                implode('="|', array_map('preg_quote', $attr, ['~'])),
936
+                implode('|', array_map('preg_quote', $scheme, ['~']))
937 937
             );
938 938
         }
939 939
 
940 940
         $text = preg_replace_callback(
941 941
             '~'.$search.'~i',
942
-            function ($matches) {
942
+            function($matches) {
943 943
                 return $this->createAbsoluteUrl($matches[1]);
944 944
             },
945 945
             $text
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
     protected function isRelativeUri($uri)
959 959
     {
960 960
         if ($uri && !parse_url($uri, PHP_URL_SCHEME)) {
961
-            if (!in_array($uri[0], [ '/', '#', '?' ])) {
961
+            if (!in_array($uri[0], ['/', '#', '?'])) {
962 962
                 return true;
963 963
             }
964 964
         }
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Object/File.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Object/Image.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Traits/AttachmentAwareTrait.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -293,7 +293,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,6 @@
 block discarded – undo
13 13
 
14 14
 // From 'locomotivemtl/charcoal-attachments'
15 15
 use Charcoal\Attachment\Interfaces\AttachableInterface;
16
-use Charcoal\Attachment\Interfaces\AttachmentContainerInterface;
17
-
18 16
 use Charcoal\Attachment\Object\Join;
19 17
 use Charcoal\Attachment\Object\Attachment;
20 18
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Traits/ConfigurableAttachmentsTrait.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Traits/AttachmentRelationTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Object/Join.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -402,7 +402,7 @@
 block discarded – undo
402 402
             );
403 403
         }
404 404
 
405
-        $this->position = (int)$position;
405
+        $this->position = (int) $position;
406 406
 
407 407
         return $this;
408 408
     }
Please login to merge, or discard this patch.
src/Charcoal/Attachment/Script/CleanupScript.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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',
Please login to merge, or discard this patch.