Skip to content

Commit 6d6885e

Browse files
Merge branch '4.4' into 5.1
* 4.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 3ac31ff + 69690af commit 6d6885e

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

AbstractUriElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(\DOMElement $node, string $currentUri = null, ?strin
4646
$this->method = $method ? strtoupper($method) : null;
4747
$this->currentUri = $currentUri;
4848

49-
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), PHP_URL_SCHEME);
49+
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), \PHP_URL_SCHEME);
5050
$baseUriIsAbsolute = \in_array(strtolower(substr($this->currentUri, 0, 4)), ['http', 'file']);
5151
if ($elementUriIsRelative && !$baseUriIsAbsolute) {
5252
throw new \InvalidArgumentException(sprintf('The URL of the element is relative, so you must define its base URI passing an absolute URL to the constructor of the "%s" class ("%s" was passed).', __CLASS__, $this->currentUri));

Crawler.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ public function addHtmlContent(string $content, string $charset = 'UTF-8')
214214
* LIBXML_PARSEHUGE is dangerous, see
215215
* http://symfony.com/blog/security-release-symfony-2-0-17-released
216216
*/
217-
public function addXmlContent(string $content, string $charset = 'UTF-8', int $options = LIBXML_NONET)
217+
public function addXmlContent(string $content, string $charset = 'UTF-8', int $options = \LIBXML_NONET)
218218
{
219219
// remove the default namespace if it's the only namespace to make XPath expressions simpler
220220
if (!preg_match('/xmlns:/', $content)) {
221221
$content = str_replace('xmlns', 'ns', $content);
222222
}
223223

224224
$internalErrors = libxml_use_internal_errors(true);
225-
if (LIBXML_VERSION < 20900) {
225+
if (\LIBXML_VERSION < 20900) {
226226
$disableEntities = libxml_disable_entity_loader(true);
227227
}
228228

@@ -234,7 +234,7 @@ public function addXmlContent(string $content, string $charset = 'UTF-8', int $o
234234
}
235235

236236
libxml_use_internal_errors($internalErrors);
237-
if (LIBXML_VERSION < 20900) {
237+
if (\LIBXML_VERSION < 20900) {
238238
libxml_disable_entity_loader($disableEntities);
239239
}
240240

@@ -442,7 +442,7 @@ public function closest(string $selector): ?self
442442

443443
$domNode = $this->getNode(0);
444444

445-
while (XML_ELEMENT_NODE === $domNode->nodeType) {
445+
while (\XML_ELEMENT_NODE === $domNode->nodeType) {
446446
$node = $this->createSubCrawler($domNode);
447447
if ($node->matches($selector)) {
448448
return $node;
@@ -503,7 +503,7 @@ public function parents()
503503
$nodes = [];
504504

505505
while ($node = $node->parentNode) {
506-
if (XML_ELEMENT_NODE === $node->nodeType) {
506+
if (\XML_ELEMENT_NODE === $node->nodeType) {
507507
$nodes[] = $node;
508508
}
509509
}
@@ -1104,7 +1104,7 @@ protected function sibling($node, string $siblingDir = 'nextSibling')
11041104

11051105
$currentNode = $this->getNode(0);
11061106
do {
1107-
if ($node !== $currentNode && XML_ELEMENT_NODE === $node->nodeType) {
1107+
if ($node !== $currentNode && \XML_ELEMENT_NODE === $node->nodeType) {
11081108
$nodes[] = $node;
11091109
}
11101110
} while ($node = $node->$siblingDir);
@@ -1122,7 +1122,7 @@ private function parseXhtml(string $htmlContent, string $charset = 'UTF-8'): \DO
11221122
$htmlContent = $this->convertToHtmlEntities($htmlContent, $charset);
11231123

11241124
$internalErrors = libxml_use_internal_errors(true);
1125-
if (LIBXML_VERSION < 20900) {
1125+
if (\LIBXML_VERSION < 20900) {
11261126
$disableEntities = libxml_disable_entity_loader(true);
11271127
}
11281128

@@ -1134,7 +1134,7 @@ private function parseXhtml(string $htmlContent, string $charset = 'UTF-8'): \DO
11341134
}
11351135

11361136
libxml_use_internal_errors($internalErrors);
1137-
if (LIBXML_VERSION < 20900) {
1137+
if (\LIBXML_VERSION < 20900) {
11381138
libxml_disable_entity_loader($disableEntities);
11391139
}
11401140

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(int $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
}
@@ -49,7 +49,7 @@ public function upload(?string $value)
4949
public function setValue(?string $value)
5050
{
5151
if (null !== $value && is_readable($value)) {
52-
$error = UPLOAD_ERR_OK;
52+
$error = \UPLOAD_ERR_OK;
5353
$size = filesize($value);
5454
$info = pathinfo($value);
5555
$name = $info['basename'];
@@ -65,7 +65,7 @@ public function setValue(?string $value)
6565
copy($value, $tmp);
6666
$value = $tmp;
6767
} else {
68-
$error = UPLOAD_ERR_NO_FILE;
68+
$error = \UPLOAD_ERR_NO_FILE;
6969
$size = 0;
7070
$name = '';
7171
$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(12345);

UriResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static function resolve(string $uri, ?string $baseUri): string
3333
$uri = trim($uri);
3434

3535
// absolute URL?
36-
if (null !== parse_url($uri, PHP_URL_SCHEME)) {
36+
if (null !== parse_url($uri, \PHP_URL_SCHEME)) {
3737
return $uri;
3838
}
3939

@@ -70,7 +70,7 @@ public static function resolve(string $uri, ?string $baseUri): string
7070
}
7171

7272
// relative path
73-
$path = parse_url(substr($baseUri, \strlen($baseUriCleaned)), PHP_URL_PATH);
73+
$path = parse_url(substr($baseUri, \strlen($baseUriCleaned)), \PHP_URL_PATH);
7474
$path = self::canonicalizePath(substr($path, 0, strrpos($path, '/')).'/'.$uri);
7575

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

0 commit comments

Comments
 (0)