Skip to content

Commit 1a4cffe

Browse files
Merge branch '2.8' into 3.4
* 2.8: (29 commits) [Console] Fix docblock of DescriptorInterface::describe [Config] Handle nullable node name + fix inheritdocs [Security] added userChecker to SimpleAuthenticationProvider [Debug] fix test Fix typo in test method name Fixes #26563 (open_basedir restriction in effect) [Debug] Reset previous exception handler ealier to prevent infinite loop add hint in Github pull request template [Validator] Fix docblock of ClassMetadata#members [BrowserKit] Fix cookie path handling when $domain is null [DoctrineBridge] Don't rely on ClassMetadataInfo->hasField in DoctrineOrmTypeGuesser anymore [BrowserKit] Improves CookieJar::get [BrowserKit] Fix Cookie's PHPDoc [DomCrawler] Change bad wording in ChoiceFormField::untick [DomCrawler] Fix the PHPDoc of ChoiceFormField::setValue [DomCrawler] Avoid a useless call to strtolower [FrameworkBundle] HttpCache is not longer abstract Php Inspections (EA Ultimate): address some of one-time used local variables [Intl] Load locale aliases to support alias fallbacks [CssSelector] Fix CSS identifiers parsing - they can start with dash ...
2 parents dcaa7fb + a7a2166 commit 1a4cffe

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ public function extract($attributes)
648648
}
649649
}
650650

651-
$data[] = $count > 1 ? $elements : $elements[0];
651+
$data[] = 1 === $count ? $elements[0] : $elements;
652652
}
653653

654654
return $data;

Field/ChoiceFormField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ public function tick()
9797
}
9898

9999
/**
100-
* Ticks a checkbox.
100+
* Unticks a checkbox.
101101
*
102102
* @throws \LogicException When the type provided is not correct
103103
*/
104104
public function untick()
105105
{
106106
if ('checkbox' !== $this->type) {
107-
throw new \LogicException(sprintf('You cannot tick "%s" as it is not a checkbox (%s).', $this->name, $this->type));
107+
throw new \LogicException(sprintf('You cannot untick "%s" as it is not a checkbox (%s).', $this->name, $this->type));
108108
}
109109

110110
$this->setValue(false);
@@ -113,7 +113,7 @@ public function untick()
113113
/**
114114
* Sets the value of the field.
115115
*
116-
* @param string $value The value of the field
116+
* @param string|array $value The value of the field
117117
*
118118
* @throws \InvalidArgumentException When value type provided is not correct
119119
*/

Field/InputFormField.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ protected function initialize()
3232
throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
3333
}
3434

35-
if ('checkbox' === strtolower($this->node->getAttribute('type'))) {
35+
$type = strtolower($this->node->getAttribute('type'));
36+
if ('checkbox' === $type) {
3637
throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
3738
}
3839

39-
if ('file' === strtolower($this->node->getAttribute('type'))) {
40+
if ('file' === $type) {
4041
throw new \LogicException('File inputs should be instances of FileFormField.');
4142
}
4243

Tests/CrawlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ public function testExtract()
413413

414414
$this->assertEquals(array('One', 'Two', 'Three'), $crawler->extract('_text'), '->extract() returns an array of extracted data from the node list');
415415
$this->assertEquals(array(array('One', 'first'), array('Two', ''), array('Three', '')), $crawler->extract(array('_text', 'class')), '->extract() returns an array of extracted data from the node list');
416+
$this->assertEquals(array(array(), array(), array()), $crawler->extract(array()), '->extract() returns empty arrays if the attribute list is empty');
416417

417418
$this->assertEquals(array(), $this->createTestCrawler()->filterXPath('//ol')->extract('_text'), '->extract() returns an empty array if the node list is empty');
418419
}

0 commit comments

Comments
 (0)