Skip to content

Commit

Permalink
minor #6277 Add is_scalar, sizeof, ini_get in list of compiled …
Browse files Browse the repository at this point in the history
…functions (jderusse)

This PR was merged into the master branch.

Discussion
----------

Add `is_scalar`, `sizeof`, `ini_get` in list of compiled functions

Add new compiled/optimized functions

is_scalar:
php/php-src@937fa6d

sizeof:
php/php-src@30df87f

ini_get:
php/php-src@e45653c

Commits
-------

cfa0bf3 Add compiled function
  • Loading branch information
SpacePossum committed Feb 8, 2022
2 parents 0f56327 + cfa0bf3 commit dbd830d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
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

0 comments on commit dbd830d

Please sign in to comment.