Skip to content

Commit c162c19

Browse files
authored
Merge pull request symfony#89 from dunglas/native_functions
Add a backslash only to opmizable functions
2 parents 82141de + 9d82e95 commit c162c19

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ return PhpCsFixer\Config::create()
5252
'strict_comparison' => true,
5353
'strict_param' => true,
5454
'ternary_to_null_coalescing' => true,
55+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
5556
])
5657
->setFinder($finder)
5758
;

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ cache:
1515
- $HOME/.composer/cache
1616

1717
before_install:
18-
- if [[ $lint = '1' ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.12.1/php-cs-fixer.phar; fi
19-
- if [[ $lint = '1' ]]; then wget https://github.com/phpstan/phpstan/releases/download/0.10.1/phpstan.phar; fi
18+
- if [[ $lint = '1' ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.0/php-cs-fixer.phar; fi
19+
- if [[ $lint = '1' ]]; then wget https://github.com/phpstan/phpstan/releases/download/0.10.3/phpstan.phar; fi
2020

2121
before_script:
2222
- phpenv config-rm xdebug.ini

src/Cookie/CookieJar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function getWebDriverCookie(string $name, string $path = '/', ?string $d
139139
}
140140

141141
$cookiePath = $cookie->getPath() ?? '/';
142-
if (0 !== \strpos($path, $cookiePath)) {
142+
if (0 !== strpos($path, $cookiePath)) {
143143
return null;
144144
}
145145

@@ -148,8 +148,8 @@ private function getWebDriverCookie(string $name, string $path = '/', ?string $d
148148
return $cookie;
149149
}
150150

151-
$cookieDomain = '.'.\ltrim($cookieDomain, '.');
152-
if ($cookieDomain !== \substr('.'.$domain, -\strlen($cookieDomain))) {
151+
$cookieDomain = '.'.ltrim($cookieDomain, '.');
152+
if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
153153
return null;
154154
}
155155

src/ProcessManager/ChromeManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(?string $chromeDriverBinary = null, ?array $argument
3434
{
3535
$this->process = new Process([$chromeDriverBinary ?: $this->findChromeDriverBinary()], null, null, null, null);
3636
$this->arguments = $arguments ?? $this->getDefaultArguments();
37-
$this->options = \array_merge($this->getDefaultOptions(), $options);
37+
$this->options = array_merge($this->getDefaultOptions(), $options);
3838
}
3939

4040
/**

src/ProcessManager/WebServerManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ public function __construct(string $documentRoot, string $hostname, int $port)
4545
}
4646

4747
$this->process = new Process(
48-
\array_merge(
48+
array_merge(
4949
[$binary],
5050
$finder->findArguments(),
5151
[
5252
'-dvariables_order=EGPCS',
5353
'-S',
54-
\sprintf('%s:%d', $this->hostname, $this->port),
54+
sprintf('%s:%d', $this->hostname, $this->port),
5555
'-t',
5656
$documentRoot,
5757
]

src/ProcessManager/WebServerReadinessProbeTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ trait WebServerReadinessProbeTrait
2727
*/
2828
private function checkPortAvailable(string $hostname, int $port, bool $throw = true): void
2929
{
30-
$resource = @\fsockopen($hostname, $port);
30+
$resource = @fsockopen($hostname, $port);
3131
if (\is_resource($resource)) {
32-
\fclose($resource);
32+
fclose($resource);
3333
if ($throw) {
3434
throw new \RuntimeException(\sprintf('The port %d is already in use.', $port));
3535
}
@@ -38,21 +38,21 @@ private function checkPortAvailable(string $hostname, int $port, bool $throw = t
3838

3939
public function waitUntilReady(Process $process, string $url, bool $ignoreErrors = false): void
4040
{
41-
$context = \stream_context_create(['http' => [
41+
$context = stream_context_create(['http' => [
4242
'ignore_errors' => $ignoreErrors,
4343
'protocol_version' => '1.1',
4444
'header' => ['Connection: close'],
4545
'timeout' => 1,
4646
]]);
4747

48-
while (Process::STATUS_STARTED !== ($status = $process->getStatus()) || false === @\file_get_contents($url, false, $context)) {
48+
while (Process::STATUS_STARTED !== ($status = $process->getStatus()) || false === @file_get_contents($url, false, $context)) {
4949
if (Process::STATUS_TERMINATED === $status) {
5050
throw new \RuntimeException($process->getErrorOutput(), $process->getExitCode());
5151
}
5252

5353
// block until the web server is ready
54-
\usleep(1000);
54+
usleep(1000);
5555
}
56-
\sleep(1);
56+
sleep(1);
5757
}
5858
}

tests/ProcessManager/WebServerManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testRun()
2525
{
2626
$server = new WebServerManager(__DIR__.'/../fixtures/', '127.0.0.1', 1234);
2727
$server->start();
28-
$this->assertContains('Hello', \file_get_contents('http://127.0.0.1:1234/basic.html'));
28+
$this->assertContains('Hello', file_get_contents('http://127.0.0.1:1234/basic.html'));
2929

3030
$server->quit();
3131
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy