Repository: briannesbitt/Carbon (php)

Issue:
diffForHumans broken after commit 0f0a245
<!--
    🛑 DON'T REMOVE ME.
    This issue template applies to all
      - bug reports,
      - feature proposals,
      - and documentation requests

    Having all those informations will allow us to know exactly
    what you expect and answer you faster and precisely (answer
    that matches your Carbon version, PHP version and usage).
    
    Note: Comments between <!- - and - -> won't appear in the final
    issue (See [Preview] tab).
-->
Hello,

I encountered an issue with the following code:
<!--
    ⚠️ Your code below (not the code from inside Carbon library)
    Be sure it's dependency-free and enough to reproduce the issue
    when we run it on:
    https://play.phpsandbox.io/embed/nesbot/carbon
-->
```php
\Carbon\Carbon::yesterday()->diffForHumans([
  'syntax' => \Carbon\CarbonInterface::DIFF_ABSOLUTE,
  'parts' => 3,
  'skip' => 's',
]);
```

Carbon version: 2.64.0
<!--
    ⚠️ Run the command `composer show nesbot/carbon` to get "versions"
-->

PHP version: 7.4.33

<!--
    Use `echo phpversion();`
    to get PHP version.

    Some issues can depends on your context, settings,
    macros, timezone, language. So to be sure the code
    you give is enough to reproduce your bug, try it
    first in:
    https://play.phpsandbox.io/embed/nesbot/carbon?input=%3C%3Fphp%0A%0Aecho%20Carbon%3A%3Aparse('2018-06-01')-%3EsubDay()-%3Emonth%3B

    You can use the [Options] button to change the version
    then when you get the bug with this editor, you can use
    the [Export] button, copy the link of the opened tab,
    then paste it in the issue. Then we can immediatly get
    your issue.
-->


I expected to get:

```
1 day 16 hours 57 minutes
```
<!--
    Always give your expectations. Each use has their owns.
    You may want daylight saving time to be taken into account,
    someone else want it to be ignored. You may want timezone
    to be used in comparisons, someone else may not, etc.
-->

But I actually get:

```
Uncaught Exception TypeError: "Argument 3 passed to Carbon\Carbon::diffAsCarbonInterval() must be of the type array, string given, called in /vendor/nesbot/carbon/src/Carbon/Traits/Difference.php on line 847" at /vendor/nesbot/carbon/src/Carbon/Traits/Difference.php line 151

```
<!--
    If you did not succeed to get the same result in
    https://play.phpsandbox.io/embed/nesbot/carbon?input=%3C%3Fphp%0A%0Aecho%20Carbon%3A%3Aparse('2018-06-01')%3B then precise the
    result you get.
-->

Thanks!


Pull request:
Enforce $skip array type
Fix #2744

Patch:
diff --git a/src/Carbon/Traits/Difference.php b/src/Carbon/Traits/Difference.php
index 4f1fceca..a9868ebf 100644
--- a/src/Carbon/Traits/Difference.php
+++ b/src/Carbon/Traits/Difference.php
@@ -844,7 +844,7 @@ trait Difference
         $parts = min(7, max(1, (int) $parts));
         $skip = \is_array($syntax) ? ($syntax['skip'] ?? []) : [];
 
-        return $this->diffAsCarbonInterval($other, false, $skip)
+        return $this->diffAsCarbonInterval($other, false, (array) $skip)
             ->setLocalTranslator($this->getLocalTranslator())
             ->forHumans($syntax, (bool) $short, $parts, $options ?? $this->localHumanDiffOptions ?? static::getHumanDiffOptions());
     }


Test patch:
diff --git a/tests/Carbon/DiffTest.php b/tests/Carbon/DiffTest.php
index 794872db..dd39fc13 100644
--- a/tests/Carbon/DiffTest.php
+++ b/tests/Carbon/DiffTest.php
@@ -621,6 +621,16 @@ class DiffTest extends AbstractTestCase
             Carbon::parse('2020-05-25')
                 ->diffForHumans(['skip' => ['y', 'm', 'w']])
         );
+
+        Carbon::setTestNow('2023-01-02 16:57');
+        $this->assertSame(
+            '1 day 16 hours 57 minutes',
+            Carbon::yesterday()->diffForHumans([
+                'syntax' => CarbonInterface::DIFF_ABSOLUTE,
+                'parts' => 3,
+                'skip' => 's',
+            ])
+        );
     }
 
     public function testDiffForHumansNowAndSecondWithTimezone()