Skip to content

Commit 82fe363

Browse files
Enable "native_constant_invocation" CS rule
1 parent 702ee65 commit 82fe363

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

AbstractUriElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getUri()
8181
$uri = trim($this->getRawUri());
8282

8383
// absolute URL?
84-
if (null !== parse_url($uri, PHP_URL_SCHEME)) {
84+
if (null !== parse_url($uri, \PHP_URL_SCHEME)) {
8585
return $uri;
8686
}
8787

@@ -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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function addContent($content, $type = null)
182182
public function addHtmlContent($content, $charset = 'UTF-8')
183183
{
184184
$internalErrors = libxml_use_internal_errors(true);
185-
if (LIBXML_VERSION < 20900) {
185+
if (\LIBXML_VERSION < 20900) {
186186
$disableEntities = libxml_disable_entity_loader(true);
187187
}
188188

@@ -205,7 +205,7 @@ public function addHtmlContent($content, $charset = 'UTF-8')
205205
}
206206

207207
libxml_use_internal_errors($internalErrors);
208-
if (LIBXML_VERSION < 20900) {
208+
if (\LIBXML_VERSION < 20900) {
209209
libxml_disable_entity_loader($disableEntities);
210210
}
211211

@@ -242,15 +242,15 @@ public function addHtmlContent($content, $charset = 'UTF-8')
242242
* LIBXML_PARSEHUGE is dangerous, see
243243
* http://symfony.com/blog/security-release-symfony-2-0-17-released
244244
*/
245-
public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET)
245+
public function addXmlContent($content, $charset = 'UTF-8', $options = \LIBXML_NONET)
246246
{
247247
// remove the default namespace if it's the only namespace to make XPath expressions simpler
248248
if (!preg_match('/xmlns:/', $content)) {
249249
$content = str_replace('xmlns', 'ns', $content);
250250
}
251251

252252
$internalErrors = libxml_use_internal_errors(true);
253-
if (LIBXML_VERSION < 20900) {
253+
if (\LIBXML_VERSION < 20900) {
254254
$disableEntities = libxml_disable_entity_loader(true);
255255
}
256256

@@ -262,7 +262,7 @@ public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NO
262262
}
263263

264264
libxml_use_internal_errors($internalErrors);
265-
if (LIBXML_VERSION < 20900) {
265+
if (\LIBXML_VERSION < 20900) {
266266
libxml_disable_entity_loader($disableEntities);
267267
}
268268

@@ -497,7 +497,7 @@ public function parents()
497497
$nodes = [];
498498

499499
while ($node = $node->parentNode) {
500-
if (XML_ELEMENT_NODE === $node->nodeType) {
500+
if (\XML_ELEMENT_NODE === $node->nodeType) {
501501
$nodes[] = $node;
502502
}
503503
}

Field/FileFormField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class FileFormField extends FormField
2727
*/
2828
public function setErrorCode($error)
2929
{
30-
$codes = [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];
30+
$codes = [\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];
3131
if (!\in_array($error, $codes)) {
3232
throw new \InvalidArgumentException(sprintf('The error code "%s" is not valid.', $error));
3333
}
@@ -53,7 +53,7 @@ public function upload($value)
5353
public function setValue($value)
5454
{
5555
if (null !== $value && is_readable($value)) {
56-
$error = UPLOAD_ERR_OK;
56+
$error = \UPLOAD_ERR_OK;
5757
$size = filesize($value);
5858
$info = pathinfo($value);
5959
$name = $info['basename'];
@@ -69,7 +69,7 @@ public function setValue($value)
6969
copy($value, $tmp);
7070
$value = $tmp;
7171
} else {
72-
$error = UPLOAD_ERR_NO_FILE;
72+
$error = \UPLOAD_ERR_NO_FILE;
7373
$size = 0;
7474
$name = '';
7575
$value = '';

Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function getUri()
203203
$uri = parent::getUri();
204204

205205
if (!\in_array($this->getMethod(), ['POST', 'PUT', 'DELETE', 'PATCH'])) {
206-
$query = parse_url($uri, PHP_URL_QUERY);
206+
$query = parse_url($uri, \PHP_URL_QUERY);
207207
$currentParameters = [];
208208
if ($query) {
209209
parse_str($query, $currentParameters);

Tests/Field/FileFormFieldTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testInitialize()
2020
$node = $this->createNode('input', '', ['type' => 'file']);
2121
$field = new FileFormField($node);
2222

23-
$this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), '->initialize() sets the value of the field to no file uploaded');
23+
$this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), '->initialize() sets the value of the field to no file uploaded');
2424

2525
$node = $this->createNode('textarea', '');
2626
try {
@@ -48,7 +48,7 @@ public function testSetValue($method)
4848
$field = new FileFormField($node);
4949

5050
$field->$method(null);
51-
$this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), "->$method() clears the uploaded file if the value is null");
51+
$this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), "->$method() clears the uploaded file if the value is null");
5252

5353
$field->$method(__FILE__);
5454
$value = $field->getValue();
@@ -91,9 +91,9 @@ public function testSetErrorCode()
9191
$node = $this->createNode('input', '', ['type' => 'file']);
9292
$field = new FileFormField($node);
9393

94-
$field->setErrorCode(UPLOAD_ERR_FORM_SIZE);
94+
$field->setErrorCode(\UPLOAD_ERR_FORM_SIZE);
9595
$value = $field->getValue();
96-
$this->assertEquals(UPLOAD_ERR_FORM_SIZE, $value['error'], '->setErrorCode() sets the file input field error code');
96+
$this->assertEquals(\UPLOAD_ERR_FORM_SIZE, $value['error'], '->setErrorCode() sets the file input field error code');
9797

9898
try {
9999
$field->setErrorCode('foobar');

0 commit comments

Comments
 (0)