minor #26544 [DomCrawler] Avoid a useless call to strtolower (dunglas)

This PR was merged into the 2.7 branch.

Discussion
----------

[DomCrawler] Avoid a useless call to strtolower

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | yes<!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? |no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

minor

Commits
-------

c77d142 [DomCrawler] Avoid a useless call to strtolower
This commit is contained in:
Nicolas Grekas 2018-03-16 10:39:46 +01:00
commit 9836dffbd2
1 changed files with 3 additions and 2 deletions

View File

@ -32,11 +32,12 @@ class InputFormField extends FormField
throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
}
if ('checkbox' === strtolower($this->node->getAttribute('type'))) {
$type = strtolower($this->node->getAttribute('type'));
if ('checkbox' === $type) {
throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
}
if ('file' === strtolower($this->node->getAttribute('type'))) {
if ('file' === $type) {
throw new \LogicException('File inputs should be instances of FileFormField.');
}