-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added assertArrayIsList() #4818
Conversation
@sebastianbergmann Would you accept this when I add more tests etc? |
Yes. |
Codecov Report
@@ Coverage Diff @@
## master #4818 +/- ##
============================================
+ Coverage 83.57% 83.60% +0.02%
- Complexity 5797 5806 +9
============================================
Files 548 549 +1
Lines 15596 15617 +21
============================================
+ Hits 13035 13056 +21
Misses 2561 2561
Continue to review full report at Codecov.
|
3cb32f6
to
0f147f5
Compare
It looks the fail of type checker is not related to this patch. |
I'll look into this. |
0f147f5
to
1e6db30
Compare
if ($other === []) { | ||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (function_exists('array_is_list')) { | |
return array_is_list($other); | |
} | |
On PHP 8.1, we have a native function for that. I suggest we leverage it if it's available.
Suggested by Alexander M. Turek <[email protected]> in #4818 (review)
Merged manually. Thanks! |
…method PHPUnit 10.0.0 introduces the new `Assert::assertIsList()` method. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * Functional tests for the functionality polyfilled. Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected. Includes: * Adding the new polyfill to the existing `TestCases` classes and adding a test for the polyfill availability to the `TestCaseTestTrait`. Refs: * sebastianbergmann/phpunit#4818 * sebastianbergmann/phpunit@71f5074 * sebastianbergmann/phpunit@e04a947 * sebastianbergmann/phpunit@2bc1aea Co-authored-by: Jaroslav Hanslík <[email protected]> Co-authored-by: Sebastian Bergmann <[email protected]>
…method PHPUnit 10.0.0 introduces the new `Assert::assertIsList()` method. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * Functional tests for the functionality polyfilled. Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected. Includes: * Adding the new polyfill to the existing `TestCases` classes and adding a test for the polyfill availability to the `TestCaseTestTrait`. Refs: * sebastianbergmann/phpunit#4818 * sebastianbergmann/phpunit@71f5074 * sebastianbergmann/phpunit@e04a947 * sebastianbergmann/phpunit@2bc1aea Co-authored-by: Jaroslav Hanslík <[email protected]> Co-authored-by: Sebastian Bergmann <[email protected]>
…method PHPUnit 10.0.0 introduces the new `Assert::assertIsList()` method. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * Functional tests for the functionality polyfilled. Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected. Includes: * Adding the new polyfill to the existing `TestCases` classes and adding a test for the polyfill availability to the `TestCaseTestTrait`. Refs: * sebastianbergmann/phpunit#4818 * sebastianbergmann/phpunit@71f5074 * sebastianbergmann/phpunit@e04a947 * sebastianbergmann/phpunit@2bc1aea Co-authored-by: Jaroslav Hanslík <[email protected]> Co-authored-by: Sebastian Bergmann <[email protected]>
…method PHPUnit 10.0.0 introduces the new `Assert::assertIsList()` method. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * Functional tests for the functionality polyfilled. Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected. Includes: * Adding the new polyfill to the existing `TestCases` classes and adding a test for the polyfill availability to the `TestCaseTestTrait`. Refs: * sebastianbergmann/phpunit#4818 * sebastianbergmann/phpunit@71f5074 * sebastianbergmann/phpunit@e04a947 * sebastianbergmann/phpunit@2bc1aea Co-authored-by: Jaroslav Hanslík <[email protected]> Co-authored-by: Sebastian Bergmann <[email protected]>
No description provided.