Skip to content

Commit 40bf4ec

Browse files
Merge branch '2.8' into 3.4
* 2.8: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents 54c9e81 + 2fd6513 commit 40bf4ec

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

AbstractUriElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class AbstractUriElement
4242
*/
4343
public function __construct(\DOMElement $node, $currentUri, $method = 'GET')
4444
{
45-
if (!in_array(strtolower(substr($currentUri, 0, 4)), array('http', 'file'))) {
45+
if (!\in_array(strtolower(substr($currentUri, 0, 4)), array('http', 'file'))) {
4646
throw new \InvalidArgumentException(sprintf('Current URI must be an absolute URL ("%s").', $currentUri));
4747
}
4848

@@ -114,7 +114,7 @@ public function getUri()
114114
}
115115

116116
// relative path
117-
$path = parse_url(substr($this->currentUri, strlen($baseUri)), PHP_URL_PATH);
117+
$path = parse_url(substr($this->currentUri, \strlen($baseUri)), PHP_URL_PATH);
118118
$path = $this->canonicalizePath(substr($path, 0, strrpos($path, '/')).'/'.$uri);
119119

120120
return $baseUri.('' === $path || '/' !== $path[0] ? '/' : '').$path;

Crawler.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ public function add($node)
112112
$this->addNodeList($node);
113113
} elseif ($node instanceof \DOMNode) {
114114
$this->addNode($node);
115-
} elseif (is_array($node)) {
115+
} elseif (\is_array($node)) {
116116
$this->addNodes($node);
117-
} elseif (is_string($node)) {
117+
} elseif (\is_string($node)) {
118118
$this->addContent($node);
119119
} elseif (null !== $node) {
120-
throw new \InvalidArgumentException(sprintf('Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "%s".', is_object($node) ? get_class($node) : gettype($node)));
120+
throw new \InvalidArgumentException(sprintf('Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "%s".', \is_object($node) ? \get_class($node) : \gettype($node)));
121121
}
122122
}
123123

@@ -211,7 +211,7 @@ public function addHtmlContent($content, $charset = 'UTF-8')
211211
$base = $this->filterRelativeXPath('descendant-or-self::base')->extract(array('href'));
212212

213213
$baseHref = current($base);
214-
if (count($base) && !empty($baseHref)) {
214+
if (\count($base) && !empty($baseHref)) {
215215
if ($this->baseHref) {
216216
$linkNode = $dom->createElement('a');
217217
$linkNode->setAttribute('href', $baseHref);
@@ -322,7 +322,7 @@ public function addNode(\DOMNode $node)
322322
}
323323

324324
// Don't add duplicate nodes in the Crawler
325-
if (in_array($node, $this->nodes, true)) {
325+
if (\in_array($node, $this->nodes, true)) {
326326
return;
327327
}
328328

@@ -381,7 +381,7 @@ public function each(\Closure $closure)
381381
*/
382382
public function slice($offset = 0, $length = null)
383383
{
384-
return $this->createSubCrawler(array_slice($this->nodes, $offset, $length));
384+
return $this->createSubCrawler(\array_slice($this->nodes, $offset, $length));
385385
}
386386

387387
/**
@@ -422,7 +422,7 @@ public function first()
422422
*/
423423
public function last()
424424
{
425-
return $this->eq(count($this->nodes) - 1);
425+
return $this->eq(\count($this->nodes) - 1);
426426
}
427427

428428
/**
@@ -635,7 +635,7 @@ public function evaluate($xpath)
635635
public function extract($attributes)
636636
{
637637
$attributes = (array) $attributes;
638-
$count = count($attributes);
638+
$count = \count($attributes);
639639

640640
$data = array();
641641
foreach ($this->nodes as $node) {
@@ -765,7 +765,7 @@ public function link($method = 'get')
765765
$node = $this->getNode(0);
766766

767767
if (!$node instanceof \DOMElement) {
768-
throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', get_class($node)));
768+
throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', \get_class($node)));
769769
}
770770

771771
return new Link($node, $this->baseHref, $method);
@@ -783,7 +783,7 @@ public function links()
783783
$links = array();
784784
foreach ($this->nodes as $node) {
785785
if (!$node instanceof \DOMElement) {
786-
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', get_class($node)));
786+
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node)));
787787
}
788788

789789
$links[] = new Link($node, $this->baseHref, 'get');
@@ -801,14 +801,14 @@ public function links()
801801
*/
802802
public function image()
803803
{
804-
if (!count($this)) {
804+
if (!\count($this)) {
805805
throw new \InvalidArgumentException('The current node list is empty.');
806806
}
807807

808808
$node = $this->getNode(0);
809809

810810
if (!$node instanceof \DOMElement) {
811-
throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', get_class($node)));
811+
throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', \get_class($node)));
812812
}
813813

814814
return new Image($node, $this->baseHref);
@@ -824,7 +824,7 @@ public function images()
824824
$images = array();
825825
foreach ($this as $node) {
826826
if (!$node instanceof \DOMElement) {
827-
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', get_class($node)));
827+
throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node)));
828828
}
829829

830830
$images[] = new Image($node, $this->baseHref);
@@ -852,7 +852,7 @@ public function form(array $values = null, $method = null)
852852
$node = $this->getNode(0);
853853

854854
if (!$node instanceof \DOMElement) {
855-
throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', get_class($node)));
855+
throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', \get_class($node)));
856856
}
857857

858858
$form = new Form($node, $this->uri, $method, $this->baseHref);
@@ -971,7 +971,7 @@ private function relativize($xpath)
971971
// We cannot simply drop
972972
$nonMatchingExpression = 'a[name() = "b"]';
973973

974-
$xpathLen = strlen($xpath);
974+
$xpathLen = \strlen($xpath);
975975
$openedBrackets = 0;
976976
$startPosition = strspn($xpath, " \t\n\r\0\x0B");
977977

@@ -1064,7 +1064,7 @@ public function getNode($position)
10641064
*/
10651065
public function count()
10661066
{
1067-
return count($this->nodes);
1067+
return \count($this->nodes);
10681068
}
10691069

10701070
/**

Field/ChoiceFormField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ChoiceFormField extends FormField
4545
public function hasValue()
4646
{
4747
// don't send a value for unchecked checkboxes
48-
if (in_array($this->type, array('checkbox', 'radio')) && null === $this->value) {
48+
if (\in_array($this->type, array('checkbox', 'radio')) && null === $this->value) {
4949
return false;
5050
}
5151

@@ -126,7 +126,7 @@ public function setValue($value)
126126
// check
127127
$this->value = $this->options[0]['value'];
128128
} else {
129-
if (is_array($value)) {
129+
if (\is_array($value)) {
130130
if (!$this->multiple) {
131131
throw new \InvalidArgumentException(sprintf('The value for "%s" cannot be an array.', $this->name));
132132
}
@@ -144,7 +144,7 @@ public function setValue($value)
144144
$value = (array) $value;
145145
}
146146

147-
if (is_array($value)) {
147+
if (\is_array($value)) {
148148
$this->value = $value;
149149
} else {
150150
parent::setValue($value);

Field/FileFormField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FileFormField extends FormField
2828
public function setErrorCode($error)
2929
{
3030
$codes = array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION);
31-
if (!in_array($error, $codes)) {
31+
if (!\in_array($error, $codes)) {
3232
throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error));
3333
}
3434

Form.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function getValues()
108108
*/
109109
public function getFiles()
110110
{
111-
if (!in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) {
111+
if (!\in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) {
112112
return array();
113113
}
114114

@@ -142,7 +142,7 @@ public function getPhpValues()
142142
$qs = http_build_query(array($name => $value), '', '&');
143143
if (!empty($qs)) {
144144
parse_str($qs, $expandedValue);
145-
$varName = substr($name, 0, strlen(key($expandedValue)));
145+
$varName = substr($name, 0, \strlen(key($expandedValue)));
146146
$values = array_replace_recursive($values, array($varName => current($expandedValue)));
147147
}
148148
}
@@ -169,7 +169,7 @@ public function getPhpFiles()
169169
$qs = http_build_query(array($name => $value), '', '&');
170170
if (!empty($qs)) {
171171
parse_str($qs, $expandedValue);
172-
$varName = substr($name, 0, strlen(key($expandedValue)));
172+
$varName = substr($name, 0, \strlen(key($expandedValue)));
173173

174174
array_walk_recursive(
175175
$expandedValue,
@@ -202,7 +202,7 @@ public function getUri()
202202
{
203203
$uri = parent::getUri();
204204

205-
if (!in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) {
205+
if (!\in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) {
206206
$query = parse_url($uri, PHP_URL_QUERY);
207207
$currentParameters = array();
208208
if ($query) {
@@ -379,7 +379,7 @@ public function disableValidation()
379379
protected function setNode(\DOMElement $node)
380380
{
381381
$this->button = $node;
382-
if ('button' === $node->nodeName || ('input' === $node->nodeName && in_array(strtolower($node->getAttribute('type')), array('submit', 'button', 'image')))) {
382+
if ('button' === $node->nodeName || ('input' === $node->nodeName && \in_array(strtolower($node->getAttribute('type')), array('submit', 'button', 'image')))) {
383383
if ($node->hasAttribute('form')) {
384384
// if the node has the HTML5-compliant 'form' attribute, use it
385385
$formId = $node->getAttribute('form');
@@ -480,7 +480,7 @@ private function addField(\DOMElement $node)
480480
}
481481
} elseif ('input' == $nodeName && 'file' == strtolower($node->getAttribute('type'))) {
482482
$this->set(new Field\FileFormField($node));
483-
} elseif ('input' == $nodeName && !in_array(strtolower($node->getAttribute('type')), array('submit', 'button', 'image'))) {
483+
} elseif ('input' == $nodeName && !\in_array(strtolower($node->getAttribute('type')), array('submit', 'button', 'image'))) {
484484
$this->set(new Field\InputFormField($node));
485485
} elseif ('textarea' == $nodeName) {
486486
$this->set(new Field\TextareaFormField($node));

FormFieldRegistry.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function add(FormField $field)
3333

3434
$target = &$this->fields;
3535
while ($segments) {
36-
if (!is_array($target)) {
36+
if (!\is_array($target)) {
3737
$target = array();
3838
}
3939
$path = array_shift($segments);
@@ -55,7 +55,7 @@ public function remove($name)
5555
{
5656
$segments = $this->getSegments($name);
5757
$target = &$this->fields;
58-
while (count($segments) > 1) {
58+
while (\count($segments) > 1) {
5959
$path = array_shift($segments);
6060
if (!array_key_exists($path, $target)) {
6161
return;
@@ -118,9 +118,9 @@ public function has($name)
118118
public function set($name, $value)
119119
{
120120
$target = &$this->get($name);
121-
if ((!is_array($value) && $target instanceof Field\FormField) || $target instanceof Field\ChoiceFormField) {
121+
if ((!\is_array($value) && $target instanceof Field\FormField) || $target instanceof Field\ChoiceFormField) {
122122
$target->setValue($value);
123-
} elseif (is_array($value)) {
123+
} elseif (\is_array($value)) {
124124
$fields = self::create($name, $value);
125125
foreach ($fields->all() as $k => $v) {
126126
$this->set($k, $v);
@@ -173,7 +173,7 @@ private function walk(array $array, $base = '', array &$output = array())
173173
{
174174
foreach ($array as $k => $v) {
175175
$path = empty($base) ? $k : sprintf('%s[%s]', $base, $k);
176-
if (is_array($v)) {
176+
if (\is_array($v)) {
177177
$this->walk($v, $path, $output);
178178
} else {
179179
$output[$path] = $v;

Tests/FormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function testConstructor($message, $form, $values)
191191
$values,
192192
array_map(
193193
function ($field) {
194-
$class = get_class($field);
194+
$class = \get_class($field);
195195

196196
return array(substr($class, strrpos($class, '\\') + 1), $field->getValue());
197197
},

0 commit comments

Comments
 (0)