Revert "Issue #3172166 by Pooja Ganjage, ekes, Megha_kundar, tstoeckler, mbovan, Spokje, alexpott: Element::properties() produces notices if given an array with integer keys"
This reverts commit 60a4206017
.
merge-requests/1745/head
parent
faa65808cc
commit
cf5f35c289
|
@ -24,7 +24,7 @@ class Element {
|
||||||
* TRUE of the key is a property, FALSE otherwise.
|
* TRUE of the key is a property, FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
public static function property($key) {
|
public static function property($key) {
|
||||||
return is_string($key) && $key[0] == '#';
|
return $key[0] == '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,6 @@ class ElementTest extends UnitTestCase {
|
||||||
$this->assertTrue(Element::property('#property'));
|
$this->assertTrue(Element::property('#property'));
|
||||||
$this->assertFalse(Element::property('property'));
|
$this->assertFalse(Element::property('property'));
|
||||||
$this->assertFalse(Element::property('property#'));
|
$this->assertFalse(Element::property('property#'));
|
||||||
$this->assertFalse(Element::property(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,16 +29,13 @@ class ElementTest extends UnitTestCase {
|
||||||
'#property1' => 'property1',
|
'#property1' => 'property1',
|
||||||
'#property2' => 'property2',
|
'#property2' => 'property2',
|
||||||
'property3' => 'property3',
|
'property3' => 'property3',
|
||||||
0 => [],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$properties = Element::properties($element);
|
$properties = Element::properties($element);
|
||||||
|
|
||||||
$this->assertCount(2, $properties);
|
|
||||||
$this->assertContains('#property1', $properties);
|
$this->assertContains('#property1', $properties);
|
||||||
$this->assertContains('#property2', $properties);
|
$this->assertContains('#property2', $properties);
|
||||||
$this->assertNotContains('property3', $properties);
|
$this->assertNotContains('property3', $properties);
|
||||||
$this->assertNotContains(0, $properties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue