Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_scalar, sizeof, ini_get in list of compiled functions #6277

Merged
merged 1 commit into from Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php
Expand Up @@ -380,17 +380,22 @@ private function getAllCompilerOptimizedFunctionsNormalized(): array
'is_object',
'is_real',
'is_resource',
'is_scalar',
'is_string',
'ord',
'sizeof',
'strlen',
'strval',
// @see https://github.com/php/php-src/blob/php-7.2.6/ext/opcache/Optimizer/pass1_5.c
// @see https://github.com/php/php-src/blob/PHP-8.1.2/Zend/Optimizer/block_pass.c
// @see https://github.com/php/php-src/blob/php-8.1.3/Zend/Optimizer/zend_optimizer.c
'constant',
'define',
'dirname',
'extension_loaded',
'function_exists',
'is_callable',
'ini_get',
]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Fixer/PhpTag/NoClosingTagFixerTest.php
Expand Up @@ -36,7 +36,7 @@ public function testWithFullOpenTag(string $expected, ?string $input = null): vo
*/
public function testWithShortOpenTag(string $expected, ?string $input = null): void
{
if (!ini_get('short_open_tag')) {
if (!\ini_get('short_open_tag')) {
static::markTestSkipped('The short_open_tag option is required to be enabled.');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Fixer/Semicolon/NoEmptyStatementFixerTest.php
Expand Up @@ -521,7 +521,7 @@ public function log($msg)
*/
public function testCasesWithShortOpenTag(string $expected, ?string $input = null): void
{
if (!ini_get('short_open_tag')) {
if (!\ini_get('short_open_tag')) {
static::markTestSkipped('No short tag tests possible.');
}

Expand Down
Expand Up @@ -101,7 +101,7 @@ public function provideFixPre80Cases(): \Generator

public function testOpenWithEcho(): void
{
if (!ini_get('short_open_tag')) {
if (!\ini_get('short_open_tag')) {
static::markTestSkipped('The short_open_tag option is required to be enabled.');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Tokenizer/TokensTest.php
Expand Up @@ -375,8 +375,8 @@ public function provideMonolithicPhpDetectionCases(): iterable
yield [false, 'Hello<?php echo "World!"; ?>'];
yield [false, '<?php echo "Hello"; ?> World!'];
// short open tag
yield [(bool) ini_get('short_open_tag'), "<?\n"];
yield [(bool) ini_get('short_open_tag'), "<?\n?>"];
yield [(bool) \ini_get('short_open_tag'), "<?\n"];
yield [(bool) \ini_get('short_open_tag'), "<?\n?>"];
yield [false, " <?\n"];
yield [false, "<?\n?> "];
yield [false, "<?\n?><?\n"];
Expand Down