Skip to content

Commit 69690af

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 6dd1e7a + 82fe363 commit 69690af

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

AbstractUriElement.php

Lines changed: 3 additions & 3 deletions
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));
@@ -83,7 +83,7 @@ public function getUri()
8383
$uri = trim($this->getRawUri());
8484

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

@@ -116,7 +116,7 @@ public function getUri()
116116
}
117117

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

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

Crawler.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,15 @@ public function addHtmlContent($content, $charset = 'UTF-8')
222222
* LIBXML_PARSEHUGE is dangerous, see
223223
* http://symfony.com/blog/security-release-symfony-2-0-17-released
224224
*/
225-
public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET)
225+
public function addXmlContent($content, $charset = 'UTF-8', $options = \LIBXML_NONET)
226226
{
227227
// remove the default namespace if it's the only namespace to make XPath expressions simpler
228228
if (!preg_match('/xmlns:/', $content)) {
229229
$content = str_replace('xmlns', 'ns', $content);
230230
}
231231

232232
$internalErrors = libxml_use_internal_errors(true);
233-
if (LIBXML_VERSION < 20900) {
233+
if (\LIBXML_VERSION < 20900) {
234234
$disableEntities = libxml_disable_entity_loader(true);
235235
}
236236

@@ -242,7 +242,7 @@ public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NO
242242
}
243243

244244
libxml_use_internal_errors($internalErrors);
245-
if (LIBXML_VERSION < 20900) {
245+
if (\LIBXML_VERSION < 20900) {
246246
libxml_disable_entity_loader($disableEntities);
247247
}
248248

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

456456
$domNode = $this->getNode(0);
457457

458-
while (XML_ELEMENT_NODE === $domNode->nodeType) {
458+
while (\XML_ELEMENT_NODE === $domNode->nodeType) {
459459
$node = $this->createSubCrawler($domNode);
460460
if ($node->matches($selector)) {
461461
return $node;
@@ -516,7 +516,7 @@ public function parents()
516516
$nodes = [];
517517

518518
while ($node = $node->parentNode) {
519-
if (XML_ELEMENT_NODE === $node->nodeType) {
519+
if (\XML_ELEMENT_NODE === $node->nodeType) {
520520
$nodes[] = $node;
521521
}
522522
}
@@ -537,7 +537,7 @@ public function parents()
537537
public function children(/* string $selector = null */)
538538
{
539539
if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
540-
@trigger_error(sprintf('The "%s()" method will have a new "string $selector = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
540+
@trigger_error(sprintf('The "%s()" method will have a new "string $selector = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
541541
}
542542
$selector = 0 < \func_num_args() ? func_get_arg(0) : null;
543543

@@ -619,7 +619,7 @@ public function text(/* string $default = null, bool $normalizeWhitespace = true
619619

620620
if (\func_num_args() <= 1) {
621621
if (trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text)) !== $text) {
622-
@trigger_error(sprintf('"%s()" will normalize whitespaces by default in Symfony 5.0, set the second "$normalizeWhitespace" argument to false to retrieve the non-normalized version of the text.', __METHOD__), E_USER_DEPRECATED);
622+
@trigger_error(sprintf('"%s()" will normalize whitespaces by default in Symfony 5.0, set the second "$normalizeWhitespace" argument to false to retrieve the non-normalized version of the text.', __METHOD__), \E_USER_DEPRECATED);
623623
}
624624

625625
return $text;
@@ -1165,7 +1165,7 @@ protected function sibling($node, $siblingDir = 'nextSibling')
11651165

11661166
$currentNode = $this->getNode(0);
11671167
do {
1168-
if ($node !== $currentNode && XML_ELEMENT_NODE === $node->nodeType) {
1168+
if ($node !== $currentNode && \XML_ELEMENT_NODE === $node->nodeType) {
11691169
$nodes[] = $node;
11701170
}
11711171
} while ($node = $node->$siblingDir);
@@ -1183,7 +1183,7 @@ private function parseXhtml(string $htmlContent, string $charset = 'UTF-8'): \DO
11831183
$htmlContent = $this->convertToHtmlEntities($htmlContent, $charset);
11841184

11851185
$internalErrors = libxml_use_internal_errors(true);
1186-
if (LIBXML_VERSION < 20900) {
1186+
if (\LIBXML_VERSION < 20900) {
11871187
$disableEntities = libxml_disable_entity_loader(true);
11881188
}
11891189

@@ -1195,7 +1195,7 @@ private function parseXhtml(string $htmlContent, string $charset = 'UTF-8'): \DO
11951195
}
11961196

11971197
libxml_use_internal_errors($internalErrors);
1198-
if (LIBXML_VERSION < 20900) {
1198+
if (\LIBXML_VERSION < 20900) {
11991199
libxml_disable_entity_loader($disableEntities);
12001200
}
12011201

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)