From c77d1428e8fb77faf8fbc4c6a71d1cd27063616e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 15 Mar 2018 17:07:34 +0100 Subject: [PATCH] [DomCrawler] Avoid a useless call to strtolower --- src/Symfony/Component/DomCrawler/Field/InputFormField.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/Field/InputFormField.php b/src/Symfony/Component/DomCrawler/Field/InputFormField.php index 090913efa3..1c3c84d721 100644 --- a/src/Symfony/Component/DomCrawler/Field/InputFormField.php +++ b/src/Symfony/Component/DomCrawler/Field/InputFormField.php @@ -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.'); }