mirror of
https://github.com/yiisoft/yii2.git
synced 2025-10-31 02:28:35 +08:00
Revert use @requires.
This commit is contained in:
@ -136,12 +136,14 @@ class ArrayHelperTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires PHP < 8.1
|
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testRemoveWithFloat()
|
public function testRemoveWithFloat()
|
||||||
{
|
{
|
||||||
|
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
|
||||||
|
$this->markTestSkipped('Using floats as array key is deprecated.');
|
||||||
|
}
|
||||||
|
|
||||||
$array = ['name' => 'b', 'age' => 3, 1.1 => null];
|
$array = ['name' => 'b', 'age' => 3, 1.1 => null];
|
||||||
|
|
||||||
$name = ArrayHelper::remove($array, 'name');
|
$name = ArrayHelper::remove($array, 'name');
|
||||||
@ -525,12 +527,14 @@ class ArrayHelperTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires PHP < 8.1
|
|
||||||
*
|
|
||||||
* @see https://github.com/yiisoft/yii2/pull/11549
|
* @see https://github.com/yiisoft/yii2/pull/11549
|
||||||
*/
|
*/
|
||||||
public function testGetValueWithFloatKeys()
|
public function testGetValueWithFloatKeys()
|
||||||
{
|
{
|
||||||
|
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
|
||||||
|
$this->markTestSkipped('Using floats as array key is deprecated.');
|
||||||
|
}
|
||||||
|
|
||||||
$array = [];
|
$array = [];
|
||||||
$array[1.1] = 'some value';
|
$array[1.1] = 'some value';
|
||||||
$array[2.1] = null;
|
$array[2.1] = null;
|
||||||
@ -750,11 +754,12 @@ class ArrayHelperTest extends TestCase
|
|||||||
$this->assertFalse(ArrayHelper::keyExists('c', $array, false));
|
$this->assertFalse(ArrayHelper::keyExists('c', $array, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @requires PHP < 8.1
|
|
||||||
*/
|
|
||||||
public function testKeyExistsWithFloat()
|
public function testKeyExistsWithFloat()
|
||||||
{
|
{
|
||||||
|
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
|
||||||
|
$this->markTestSkipped('Using floats as array key is deprecated.');
|
||||||
|
}
|
||||||
|
|
||||||
$array = [
|
$array = [
|
||||||
1 => 3,
|
1 => 3,
|
||||||
2.2 => 4, // Note: Floats are cast to ints, which means that the fractional part will be truncated.
|
2.2 => 4, // Note: Floats are cast to ints, which means that the fractional part will be truncated.
|
||||||
|
|||||||
Reference in New Issue
Block a user